dstandish edited a comment on issue #5263: [AIRFLOW-4490] dag_run.conf should 
be an empty dictionary by default instead of None
URL: https://github.com/apache/airflow/pull/5263#issuecomment-491671014
 
 
   > Is there ever a case where the DagRun is not committed to that database 
immediately?
   
   Intuitively, it seems likely impossible in actual execution.  But if you are 
experimenting in interactive console, as you have demonstrated, it is certainly 
possible. (And I do that sometimes when working out template behavior.)
   Another alternative approach to this would be to leave default value alone, 
but just add a `get_conf` method on `DagRun`, just like there is now with 
`get_dag`.  `get_conf` could return an empty dict if there is no conf.
   We could also add a `get_dag_run_conf` method to `TaskInstance`, which would 
also handle the case when there is no `dag_run`.  Then you could safely do 
something like 
   `{{ ti.get_dag_run_conf.get('start_date') or ds }}` in templates.
   Or maybe it would make more sense to define it so the method is conf param 
getter rather than conf getter: e.g. `{{ ti.dag_run_conf_get('start_date') or 
ds }}`.
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to