title: Airflow: Dynamically derive dag_id to be called from another DAG
body: <p>I am trying to derive name of the DAG to be called in another DAG dynamically. In the following task "trigger_transform_dag" fails to execute. Can you please help me with deriving the dag id for task 'trigger_transform_dag' dynamically</p>
  
  <pre><code>default_args = {
      'owner': 'airflow',
      'depends_on_past': False,
      'email': ['airflow@example.com'],
      'email_on_failure': False,
      'email_on_retry': False,
      'retries': 1,
      'retry_delay': timedelta(minutes=5),
      'start_date': airflow.utils.dates.days_ago(0),
  }
  
  def run_dag(**context):
      file_path='ABC'
      context['ti'].xcom_push(key = 'key1', value = file_path)
      return 1
  
  
  def check_file_name(**context):
      pulled_value_1 = context['ti'].xcom_pull(task_ids = 'run_dataflow_template',key = 'key1')
      if pulled_value_1 = 'ABC':
         push_value = 'sample1'
         return push_value
      else:
         push_value = 'sample2'
         return push_value
  
  
      return pulled_value_1
  
  
  
  with DAG('sample',
            default_args=default_args,
            schedule_interval='10 * * * *',
            start_date=datetime(2017, 3, 20),
            max_active_runs=1,
            catchup=False) as dag:
  
  
      t1 = PythonOperator(
              task_id='run_dataflow_template',
              provide_context=True,
              python_callable=run_dag
      )
  
      t2 = TriggerDagRunOperator(
      task_id="trigger_transform_dag",
      provide_context=True,
      trigger_dag_id=check_file_name()
      )
  
  
      end = DummyOperator(
          trigger_rule='one_success',
          task_id='end')
  
  
      t1 &gt;&gt; t2 &gt;&gt; end
  </code></pre>