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:41:17 UTC

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

mik-laj commented on a change in pull request #8394: Allow allow multiple extra_packages in Dataflow
URL: https://github.com/apache/airflow/pull/8394#discussion_r410908722
 
 

 ##########
 File path: airflow/providers/google/cloud/hooks/dataflow.py
 ##########
 @@ -681,14 +681,24 @@ 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 Apache 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(f"--{attr}")
+            elif isinstance(value, bool):
+                if value:  # pylint: disable=too-many-nested-blocks
                     command.append("--" + attr)
 
 Review comment:
   ```suggestion
               elif isinstance(value, bool) and value
                   command.append("--" + attr)
   ```

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