Created
November 26, 2019 15:27
-
-
Save chandulal/7c90e7c0ba12ec8150d9301f152a1ff0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def push_to_xcoms(*args, **kwargs): | |
value = "dummyValue" | |
kwargs['ti'].xcom_push(key="dummyKey", value=value) | |
def pull_from_xcoms(**kwargs): | |
ti = kwargs['ti'] | |
pulled_value = ti.xcom_pull(key='dummyKey', task_ids='push_to_xcoms') | |
print("value=" + str(pulled_value)) | |
push_to_xcoms_task = PythonOperator( | |
task_id='push_to_xcoms', | |
provide_context=True, | |
python_callable=push_to_xcoms, | |
dag=dag | |
) | |
pull_from_xcoms_task = PythonOperator( | |
task_id='pull_from_xcoms', | |
provide_context=True, | |
python_callable=pull_from_xcoms, | |
dag=dag | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment