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 2020/04/19 13:32:07 UTC

[GitHub] [airflow] turbaszek commented on a change in pull request #8394: Allow allow multiple extra_packages in Dataflow

turbaszek commented on a change in pull request #8394: Allow allow multiple extra_packages in Dataflow
URL: https://github.com/apache/airflow/pull/8394#discussion_r410904955
 
 

 ##########
 File path: airflow/providers/google/cloud/hooks/dataflow.py
 ##########
 @@ -681,14 +681,25 @@ def _build_cmd(variables: Dict, label_formatter: Callable, project_id: str) -> L
             "--runner=DataflowRunner",
             "--project={}".format(project_id),
         ]
-        if variables is not None:
-            for attr, value in variables.items():
-                if attr == 'labels':
-                    command += label_formatter(value)
-                elif value is None or value.__len__() < 1:
+        if variables is None:
+            return command
+
+        # The logic of this method should be compatible with Apachea Beam:
+        # https://github.com/apache/beam/blob/b56740f0e8cd80c2873412847d0b336837429fb9/sdks/python/
+        # apache_beam/options/pipeline_options.py#L230-L251
+        for attr, value in variables.items():
+            if attr == 'labels':
+                command += label_formatter(value)
+            elif value is None:
+                command.append("--" + attr)
 
 Review comment:
   ```suggestion
                   command.append(f"--{attr}")
   ```
   WDYT?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services