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

ASF GitHub Bot commented on AIRFLOW-6704:
-----------------------------------------

yuqian90 commented on pull request #7324:
URL: https://github.com/apache/airflow/pull/7324#issuecomment-642350478


   Hi @shanit-saha 
   
   > execution_date=datetime.now()
   
   I think this line is the cause of the problem. I believe what you actually 
want to express is to trigger `dag_process_pos` with `execution_date` equal to 
the datetime **at the time of executing** `TriggerDagRunOperator`.
   
   However, doing `execution_date=datetime.now()` at the time of constructing 
`TriggerDagRunOperator` means you are triggering `dag_process_pos`  at the time 
of **parsing** the DAG that contains the `TriggerDagRunOperator`. Since the 
value of `execution_date` keeps changing each time the DAG is parsed, the 
result is some kind of unexpected errors.
   
   I think you already realized if you leave `execution_date` as None, 
`TriggerDagRunOperator` defaults to `timezone.utcnow().isoformat()` which does 
what you need. Alternatively you can also set `execution_date` to a jinja 
template str yourself. The gist is that you should not have an argument that 
keeps changing whenever the DAG is parsed.
   
   If you think the doc of `TriggerDagRunOperator` needs to be improved. Pls 
create an issue for that separately.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> TaskInstance.operator is not set when task is marked success or failed in the 
> Web UI
> ------------------------------------------------------------------------------------
>
>                 Key: AIRFLOW-6704
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-6704
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: models
>    Affects Versions: 1.10.7
>            Reporter: Qian Yu
>            Assignee: Qian Yu
>            Priority: Major
>             Fix For: 1.10.10
>
>
> {{TaskInstance.operator}} is currently only set when task is executed. But if 
> a task is marked success or failed, the {{operator}} field is left as 
> {{None}}.
> This causes bugs when some code tries to use the operator field to find the 
> name of the class.
> The fix is trivial, just set {{TaskInstance.operator}} in its constructor.



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

Reply via email to