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

Ivan Gozali commented on AIRFLOW-733:
-------------------------------------

Bringing up this issue to attention again. 

Deferred DAG assignments could be useful when we would like to use the same 
operator across different DAGs (so that we don't have to repeat the parameters 
in that same operator). Example of this is an {{EmailOperator}} with the same 
{{html_content}}. We can construct an operator in a common Python module, which 
other DAGfiles can then import and assign the DAG later.

It seems quite likely that people would encounter this error when trying out 
the deferred DAG assignment functionality, given that the examples in the 
website use {{default_args}}.

Currently, the workaround is by passing an explicit {{start_date}} parameter 
when calling the DAG constructor, but it would be nice if we could use 
{{default_args}}.

Since the original issue didn't mention versions, I'm using Airflow 1.8.0.

> Deferred DAG assignment breaks with default_args
> ------------------------------------------------
>
>                 Key: AIRFLOW-733
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-733
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: models
>            Reporter: George Sakkis
>            Priority: Minor
>
> Deferred DAG assignment raises {{AirflowException}} if the dag has 
> {{default_args}} instead of {{start_date}}:
> {noformat}
> default_args = {'start_date': datetime(2016, 1, 1)}
> dag = DAG('my_dag2', default_args=default_args)
> deferred_op = DummyOperator(task_id='dummy')
> deferred_op.dag = dag
> ---------------------------------------------------------------------------
> AirflowException                          Traceback (most recent call last)
> <ipython-input-7-d9ff2f9c7283> in <module>()
> ----> 1 deferred_op.dag = dag
> ...
> AirflowException: Task is missing the start_date parameter
> {noformat}



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

Reply via email to