コード例 #1
0
    dag=dag)
start_task.doc = doc

t11 = BashOperator(task_id='catchup_control',
                   bash_command="echo AAAAAAAAAAAAA BBBBBBBBBB CCCCCCCCCC " +
                   str(datetime.now()),
                   dag=dag)

start_task >> t11

# Extract
doc = """Extract from source database"""
extract_task = PythonOperator(task_id='extract_from_db',
                              python_callable=extract_from_source_db,
                              provide_context=True)
extract_task.doc = doc
start_task >> extract_task
#
#
# # Transform
# doc = """Transform data"""
# transform_task = PythonOperator(
#     task_id='transform_data',
#     python_callable=transform_data,
#     provide_context=True
# )
# transform_task.doc = doc
# extract_task >> transform_task
#
#
# # Load
コード例 #2
0
    python_callable=util.is_latest_active_dagrun,
    provide_context=True,
    depends_on_past=True,
    dag=dag
)
start_task.doc = doc


# Extract
doc = """Extract from source database"""
extract_task = PythonOperator(
    task_id='extract_from_db',
    python_callable=extract_from_source_db,
    provide_context=True
)
extract_task.doc = doc
start_task >> extract_task


# Transform
doc = """Transform data"""
transform_task = PythonOperator(
    task_id='transform_data',
    python_callable=transform_data,
    provide_context=True
)
transform_task.doc = doc
extract_task >> transform_task


# Load