uranusjr commented on code in PR #27776:
URL: https://github.com/apache/airflow/pull/27776#discussion_r1080874876


##########
airflow/providers/google/cloud/hooks/dataflow.py:
##########
@@ -719,6 +698,40 @@ def start_template_dataflow(
         jobs_controller.wait_for_done()
         return response["job"]
 
+    def _update_environment(self, variables: dict, environment: dict | None = 
None) -> dict:
+        environment = environment or {}
+        # available keys for runtime environment are listed here:
+        # 
https://cloud.google.com/dataflow/docs/reference/rest/v1b3/RuntimeEnvironment
+        environment_keys = [
+            "numWorkers",
+            "maxWorkers",
+            "zone",
+            "serviceAccountEmail",
+            "tempLocation",
+            "bypassTempDirValidation",
+            "machineType",
+            "additionalExperiments",
+            "network",
+            "subnetwork",
+            "additionalUserLabels",
+            "kmsKeyName",
+            "ipConfiguration",
+            "workerRegion",
+            "workerZone",
+        ]
+
+        for key in variables:
+            if key in environment_keys:
+                if key in environment:
+                    self.log.warning(
+                        "'%s' parameter in 'variables' will override of "
+                        "the same one passed in 'environment'!",
+                        key,
+                    )
+                environment.update({key: variables[key]})

Review Comment:
   ```suggestion
           def _check_one(key, val):
               if key in environment:
                   self.log.warning(
                       "%r parameter in 'variables' will override of "
                       "the same one passed in 'environment'!",
                       key,
                   )
               return key, val
   
           environment.update(
               _check_one(key, val)
               for key, val in variables.items()
               if key in environment_keys
           )
   ```



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to