title: How to use the result of a BashOperator task as argument of another Airflow task?
body: <p>I need to pass a <strong>job_id</strong> parameter to my object <strong>DatabricksRunNowOperator()</strong>. The <strong>job_id</strong> is the result of executing the <code>databricks jobs create --json '{myjson}</code> command.</p>
  
  <blockquote>
    <p><code>$ databricks jobs create --json '{myjson}'</code> </p>
    
    <p>{job_id: 12}</p>
  </blockquote>
  
  <pre><code>import os
  import subprocess    
  from airflow import DAG
  from airflow.operators.bash_operator import BashOperator
  from airflow.contrib.operators.databricks_operator import DatabricksRunNowOperator
  
  def pull_function():
      returned_output = subprocess.check_output("echo ti.xcom_pull(key='jobid_CreateCreateRobot')")
      return returned_output
  
  
  dag_CreateRobot = DAG(dag_id='CreateRobot', 
                        default_args={'owner': 'eric', 
                                    'email': [],
                                    'depends_on_past': False, 
                                    'start_date':'2019-09-16 16:48:28.803023', 
                                    'provide_context': True}, 
                        schedule_interval='@once')
  
  CreateRobot = BashOperator(dag=dag_CreateRobot, 
                                   task_id='CreateRobot', 
                                   bash_command="databricks jobs create --json '{myjson}')")\
  
  RunRobot = DatabricksRunNowOperator(dag=dag_CreateRobot, 
                                      task_id=ti.xcom_pull('RunCreateRobot'), 
                                      job_id=pull_function(), 
                                      databricks_conn_id='myconn', 
                                      json={'token': 'mytoken' })
  
  RunRobot.set_upstream(CreateRobot)
  </code></pre>
  
  <p>I wrote this code for explaining my goal but it does not work. How can I do for using the result of a BashOperator task into other task that depends of it?</p>