mik-laj commented on a change in pull request #8531:
URL: https://github.com/apache/airflow/pull/8531#discussion_r416195651



##########
File path: airflow/providers/google/cloud/hooks/dataflow.py
##########
@@ -548,23 +554,17 @@ def start_template_dataflow(
         :type location: str
         """
         name = self._build_dataflow_job_name(job_name, append_job_name)
-        # Builds RuntimeEnvironment from variables dictionary
-        # 
https://cloud.google.com/dataflow/docs/reference/rest/v1b3/RuntimeEnvironment
-        environment = {}
-        for key in ['numWorkers', 'maxWorkers', 'zone', 'serviceAccountEmail',
-                    'tempLocation', 'bypassTempDirValidation', 'machineType',
-                    'additionalExperiments', 'network', 'subnetwork', 
'additionalUserLabels']:
-            if key in variables:
-                environment.update({key: variables[key]})
-        body = {"jobName": name,
-                "parameters": parameters,
-                "environment": environment}
+
         service = self.get_conn()
         request = service.projects().locations().templates().launch(  # 
pylint: disable=no-member
             projectId=project_id,
             location=location,
             gcsPath=dataflow_template,
-            body=body
+            body={
+                "jobName": name,
+                "parameters": parameters,
+                "environment": variables

Review comment:
       I want to change names for more parameters in many places. I will 
probably do it with a special decorator that will allow me to do it cleverly.
   ```
       @rename_parameter({'variables': 'environment'})
       def start_template_dataflow(
           self,
           job_name: str,
           variables: Dict,
           parameters: Dict,
           dataflow_template: str,
           project_id: str,
           append_job_name: bool = True,
           on_new_job_id_callback: Optional[Callable[[str], None]] = None,
           location: str = DEFAULT_DATAFLOW_LOCATION
       ) -> Dict:
   ```
   That way, we won't have so much outdated code in the repository.
   
   This change from a perspective will be much more problematic and I would 
like to test it in various IDEs, etc
   ![Screenshot 2020-04-28 at 00 31 
57](https://user-images.githubusercontent.com/12058428/80427302-bee93980-88e7-11ea-97bb-a8b0bdbec6f2.png)
   I would like to get similar messages when the user updates the operator.
   
   It looks simple but still needs testing and I will do it in a separate PR.
   




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


Reply via email to