Airflow ExternalTaskSensor gets stuck

后端 未结 4 1072
走了就别回头了
走了就别回头了 2020-12-10 03:46

I\'m trying to use ExternalTaskSensor and it gets stuck at poking another DAG\'s task, which has already been successfully completed.

Here, a first DAG \"a\" complet

4条回答
  •  执念已碎
    2020-12-10 04:20

    From my successful case:

    default_args = {
        'owner': 'xx',
        'retries': 2,
        'email': ALERT_EMAIL_ADDRESSES,
        'email_on_failure': True,
        'email_on_retry': False,
        'retry_delay': timedelta(seconds=30),
        # avoid stopping tasks after one day
        'depends_on_past': False,
    }
    
    dag = DAG(
        dag_id = dag_id,
        # get the datetime type value
        start_date = pendulum.strptime(current_date, "%Y, %m, %d, %H").astimezone('Europe/London').subtract(hours=1),
        description = 'xxx',
        default_args = default_args,
        schedule_interval = timedelta(hours=1),
        )
    
    ...
        external_sensor= ExternalTaskSensor(
                task_id='ext_sensor_task_update_model',
                external_dag_id='xxx',
                external_task_id='xxx'.format(log_type),
                # set the task_id to None because of the end_task
                # external_task_id = None,
                dag=dag,
                timeout = 300,
                )
    ...
    

    You can wait until the successful automatic trigger for the tasks. Don't do it manually, the start_date will be different.

提交回复
热议问题