You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Daniel Imberman (Jira)" <ji...@apache.org> on 2020/03/30 00:29:00 UTC

[jira] [Commented] (AIRFLOW-879) apply_defaults ignored with BaseOperator._set_relatives dag assignment

    [ https://issues.apache.org/jira/browse/AIRFLOW-879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17070614#comment-17070614 ] 

Daniel Imberman commented on AIRFLOW-879:
-----------------------------------------

This issue has been moved to https://github.com/apache/airflow/issues/7995

> apply_defaults ignored with BaseOperator._set_relatives dag assignment
> ----------------------------------------------------------------------
>
>                 Key: AIRFLOW-879
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-879
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: core
>            Reporter: George Leslie-Waksman
>            Priority: Major
>
> When a task is instantiated, the apply_defaults decorator retrieves default_args and params from the task's dag's defaults_args and params if a dag is specified.
> During set_upstream/set_downstream if task A has a dag assigned but task B does not, task B will be assigned the dag from task A.
> The set_upstream/set_downstream implicit dag assignment occurs after apply_defaults has been processed so the task will not receive the dag's default args.
> {code:title=bad_arg_dag.py}
> import datetime
> import airflow.models
> from airflow.operators.dummy_operator import DummyOperator
> DAG = airflow.models.DAG(
>     dag_id='test_dag',
>     schedule_interval=None,
>     start_date=datetime.datetime(2017, 2, 14),
>     default_args={'owner': 'airflow', 'queue': 'some_queue'},
> )
> TASK1 = DummyOperator(
>     task_id='task1',
>     dag=DAG,
> )
> TASK2 = DummyOperator(
>     task_id='task2',
> )
> TASK2.set_upstream(TASK1)
> {code}
> In this case, both TASK1 and TASK2 will be assigned to DAG and TASK1 will receive the dag default queue of 'some_queue' but TASK2 will receive the airflow configuration default queue of 'default'



--
This message was sent by Atlassian Jira
(v8.3.4#803005)