You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/06/11 01:25:57 UTC

[GitHub] [airflow] yuqian90 commented on pull request #7324: [AIRFLOW-6704] Copy common TaskInstance attributes from Task

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:
users@infra.apache.org