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 2021/08/01 07:09:17 UTC

[GitHub] [airflow] msumit commented on a change in pull request #17100: WIP: Advanced Params using json-schema

msumit commented on a change in pull request #17100:
URL: https://github.com/apache/airflow/pull/17100#discussion_r680464184



##########
File path: airflow/models/dag.py
##########
@@ -1976,7 +1981,7 @@ def create_dagrun(
         run_id: Optional[str] = None,
         start_date: Optional[datetime] = None,
         external_trigger: Optional[bool] = False,
-        conf: Optional[dict] = None,
+        conf: Optional[dict] = {},

Review comment:
       @kaxil I think the way we are using the `conf` variable, it would be safe from this gotcha, for example see this
   ```
   def safe_func(args={}):
       print(args)
   
   def prob_func(arg1={}, arg2={}):
       arg2.update(arg1)
       print(arg2)
   
   if __name__ == '__main__':
       safe_func(args={'a': 1})
       safe_func()
       safe_func(args={'a': 2})
   
       prob_func(arg1={'a': 1})
       prob_func()
       prob_func(arg1={'a': 2})
   ```
   generate outputs:
   ```
   {'a': 1}
   {}
   {'a': 2}
   {'a': 1}
   {'a': 1}
   {'a': 2}
   ```




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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