Skip to content

Instantly share code, notes, and snippets.

@chandulal
Created November 26, 2019 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chandulal/b2a2ed3e896a4776d15e82522111f368 to your computer and use it in GitHub Desktop.
Save chandulal/b2a2ed3e896a4776d15e82522111f368 to your computer and use it in GitHub Desktop.
def push_to_xcoms(*args, **kwargs):
value = "dummyValue"
kwargs['ti'].xcom_push(key="dummyKey", value=value)
push_to_xcoms_task = PythonOperator(
task_id='push_to_xcoms',
provide_context=True,
python_callable=push_to_xcoms,
dag=dag
)
templated_xcoms_value_task = BashOperator(
task_id='templated_xcoms_value',
bash_command='echo ' + str("{{ ti.xcom_pull(key='dummyKey')}}"),
dag=dag
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment