Daniel Huang created AIRFLOW-881:
------------------------------------
Summary: 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)