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/12/24 11:12:10 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #20361: Add context var hook to inject more env vars

uranusjr commented on a change in pull request #20361:
URL: https://github.com/apache/airflow/pull/20361#discussion_r774981167



##########
File path: airflow/utils/operator_helpers.py
##########
@@ -75,6 +86,16 @@ def context_to_airflow_vars(context: Mapping[str, Any], in_env_var_format: bool
         (dag_run, 'run_id', 'AIRFLOW_CONTEXT_DAG_RUN_ID'),
     ]
 
+    context_params = settings.get_airflow_context_vars(context)
+    for key, value in context_params.items():
+        if in_env_var_format:
+            if not key.startswith(ENV_VAR_FORMAT_PREFIX):
+                key = ENV_VAR_FORMAT_PREFIX + key.upper()
+        else:
+            if not key.startswith(DEFAULT_FORMAT_PREFIX):
+                key = DEFAULT_FORMAT_PREFIX + key
+        params[key] = value

Review comment:
       Some validation is needed to ensure the dict still only contain str.




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