You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2017/02/19 08:48:44 UTC

[jira] [Commented] (AIRFLOW-881) Create SubDagOperator within DAG context manager without passing dag param

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

ASF subversion and git services commented on AIRFLOW-881:
---------------------------------------------------------

Commit 0ed608dca7b465a4107e7910dfaa838fbd702fdd in incubator-airflow's branch refs/heads/master from [~dxhuang]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-airflow.git;h=0ed608d ]

[AIRFLOW-881] Check if SubDagOperator is in DAG context manager

When initializing a SubDagOperator, the `dag`
param should not be
required if it is within a DAG context manager. So
we check if that
is the case and use that as the parent DAG if
found (and `dag` param
is not specified).

Closes #2087 from dhuang/AIRFLOW-881


> Create SubDagOperator within DAG context manager without passing dag param
> --------------------------------------------------------------------------
>
>                 Key: AIRFLOW-881
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-881
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: operators, subdag
>            Reporter: Daniel Huang
>            Assignee: Daniel Huang
>            Priority: Trivial
>
> Currently, the following raises a {{Please pass in the `dag` param}} exception:
> {code}
> with DAG('my_dag', default_args=default_args) as dag:
>     op = SubDagOperator(task_id='my_subdag', subdag=subdag_factory(...))
> {code}
> But the SubDagOperator should be aware if it's in the context manager of a dag without having to specify {{dag=dag}} when initializing the operator. Similar to how the {{@apply_defaults}} decorator does it (https://github.com/apache/incubator-airflow/blob/fb0c5775cda4f84c07d8d5c0e6277fc387c172e6/airflow/utils/decorators.py#L50).



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)