当我们进入run_id
Airflow 时,如何获得时间戳(ts)?
第一:在你的任务集中provide_context=True
bye_operator = PythonOperator(
task_id='bye_task',
python_callable=print_goodbye,
provide_context=True,
dag=dag
)
第二:确保将已知参数传递到回调函数中:
def print_goodbye(**kwargs):
ts = kwargs.get('ts', None)
print(ts)
return 'Good bye world!'
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句