123456789101112131415161718 |
- write_xcom = KubernetesPodOperator(
- namespace='default',
- image='alpine',
- cmds=["sh", "-c", "mkdir -p /airflow/xcom/;echo '[1,2,3,4]' > /airflow/xcom/return.json"],
- name="write-xcom",
- do_xcom_push=True,
- is_delete_operator_pod=True,
- in_cluster=True,
- task_id="write-xcom",
- get_logs=True,
- )
- pod_task_xcom_result = BashOperator(
- bash_command="echo \"{{ task_instance.xcom_pull('write-xcom')[0] }}\"",
- task_id="pod_task_xcom_result",
- )
- write_xcom >> pod_task_xcom_result
|