You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Darshan Mehta (JIRA)" <ji...@apache.org> on 2019/01/10 12:08:00 UTC

[jira] [Created] (AIRFLOW-3666) ExternalTaskSensor is not triggering the task

Darshan Mehta created AIRFLOW-3666:
--------------------------------------

             Summary: ExternalTaskSensor is not triggering the task
                 Key: AIRFLOW-3666
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3666
             Project: Apache Airflow
          Issue Type: Bug
          Components: DAG, scheduler
            Reporter: Darshan Mehta


Dependent task is not getting triggered even after upstream finishes successfully.

master DAG:
{code:java}
from airflow import DAG
from airflow.operators.jdbc_operator import JdbcOperator
from datetime import datetime
from airflow.operators.bash_operator import BashOperator

today = datetime.today()

default_args = {
    'depends_on_past': False,
    'retries': 0,
    'start_date': datetime(today.year, today.month, today.day),
    'schedule_interval': '@once'
}

dag = DAG('call-procedure-and-bash', default_args=default_args)

call_procedure = JdbcOperator(
    task_id='call_procedure',
    jdbc_conn_id='airflow_db2',
    sql='CALL AIRFLOW.TEST_INSERT (20)',
    dag=dag
)

call_procedure
{code}
Dependent DAG:
{code:java}
from airflow import DAG
from airflow.operators.jdbc_operator import JdbcOperator
from datetime import datetime, timedelta
from airflow.sensors.external_task_sensor import ExternalTaskSensor

today = datetime.today()

default_args = {
    'depends_on_past': False,
    'retries': 0,
    'start_date': datetime(today.year, today.month, today.day),
    'schedule_interval': '@once'
}

dag = DAG('external-dag-upstream', default_args=default_args)

task_sensor = ExternalTaskSensor(
    task_id='link_upstream',
    external_dag_id='call-procedure-and-bash',
    external_task_id='call_procedure',
    execution_delta=timedelta(minutes=-2),
    dag=dag
)

count_rows = JdbcOperator(
    task_id='count_rows',
    jdbc_conn_id='airflow_db2',
    sql='SELECT COUNT(*) FROM AIRFLOW.TEST',
    dag=dag
)

count_rows.set_upstream(task_sensor)
{code}
Master DAG executes successfully whereas downstream DAG gets stuck in 'Poking' state.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)