简体   繁体   中英

Airflow stuck while trigger ExternalTaskSensor

can anyone explain why Airflow's ExternalTaskSensor work proper on scheduling but not on trigger from Frontend? I tried several version, alway with the same result. The task stops on up_fro_reschedule.

example_external_task_marker_child and example_external_task_marker_parent

Task.log

[2020-03-08 22:25:25,071] {taskinstance.py:866} INFO - Executing <Task(ExternalTaskSensor): child_task1> on 2020-03-08T21:16:27.647772+00:00
[2020-03-08 22:25:25,075] {standard_task_runner.py:53} INFO - Started process 58496 to run task
[2020-03-08 22:25:25,261] {logging_mixin.py:91} INFO - Running <TaskInstance: example_external_task_marker_child.child_task1 2020-03-08T21:16:27.647772+00:00 [None]> on host 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa
[2020-03-08 22:25:25,363] {taskinstance.py:934} INFO - Exporting the following env vars:
AIRFLOW_CTX_DAG_OWNER=airflow
AIRFLOW_CTX_DAG_ID=example_external_task_marker_child
AIRFLOW_CTX_TASK_ID=child_task1
AIRFLOW_CTX_EXECUTION_DATE=2020-03-08T21:16:27.647772+00:00
AIRFLOW_CTX_DAG_RUN_ID=manual__2020-03-08T21:16:27.647772+00:00
[2020-03-08 22:25:25,401] {external_task_sensor.py:119} INFO - Poking for example_external_task_marker_parent.parent_task on 2020-03-08T21:16:27.647772+00:00 ... 
[2020-03-08 22:25:25,538] {taskinstance.py:1110} INFO - Rescheduling task, marking task as UP_FOR_RESCHEDULE
[2020-03-08 22:25:29,903] {logging_mixin.py:91} INFO - [2020-03-08 22:25:29,902] {local_task_job.py:103} INFO - Task exited with return code 0
[2020-03-08 22:26:43,224] {taskinstance.py:656} INFO - Dependencies all met for <TaskInstance: example_external_task_marker_child.child_task1 2020-03-08T21:16:27.647772+00:00 [queued]>
[2020-03-08 22:26:43,275] {taskinstance.py:656} INFO - Dependencies all met for <TaskInstance: example_external_task_marker_child.child_task1 2020-03-08T21:16:27.647772+00:00 [queued]>
[2020-03-08 22:26:43,275] {taskinstance.py:845} INFO - 

By default the ExternalTaskSensor will monitor the external_dag_id with the same execution date that the sensor DAG. This works great when both dags are run in a the same schedule or when you know exactly the timedelta between the two.

However, when a dag is triggered manually or by another dag, you cannot known for sure the the exact execution date of any of these two dags. This is why it failed when triggered from the frontend.

You can workaround this if you trigger your dag with TriggerDagRunOperator . Take a look at this question for more info.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM