Skip to content

Instantly share code, notes, and snippets.

@k-popov
Created March 25, 2020 15:28
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 k-popov/94ed3d28d097ad50c841df7748c223ee to your computer and use it in GitHub Desktop.
Save k-popov/94ed3d28d097ad50c841df7748c223ee to your computer and use it in GitHub Desktop.
foreign_xcom_DAG.py
#!/usr/bin/env python
from __future__ import print_function
import pytz
import datetime
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.models import XCom
from airflow.settings import TIMEZONE
with DAG('gridu_foreign_xcom', schedule_interval=None, start_date=datetime.datetime(2020, 03, 24), catchup=False) as dag:
def write_xcom():
XCom.set(
key='injected',
value='from_other',
task_id='query_the_table_dag_1_db',
dag_id='gridu_dag_1_2',
execution_date=datetime.datetime(2020,03,25,9,44,29,937856, tzinfo=pytz.utc)
)
write_op = PythonOperator(
task_id='foreign_writer',
python_callable=write_xcom,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment