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/12/28 10:28:41 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #13334: Support google-cloud-tasks>=2.0.0

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



##########
File path: airflow/providers/google/cloud/hooks/tasks.py
##########
@@ -120,20 +122,19 @@ def create_queue(
         client = self.get_conn()
 
         if queue_name:
-            full_queue_name = CloudTasksClient.queue_path(project_id, location, queue_name)
+            full_queue_name = f"projects/{project_id}/locations/{location}/queues/{queue_name}"
             if isinstance(task_queue, Queue):
                 task_queue.name = full_queue_name
             elif isinstance(task_queue, dict):
                 task_queue['name'] = full_queue_name
             else:
                 raise AirflowException('Unable to set queue_name.')
-        full_location_path = CloudTasksClient.location_path(project_id, location)
+        full_location_path = f"projects/{project_id}/locations/{location}"
         return client.create_queue(
-            parent=full_location_path,
-            queue=task_queue,
+            request={'parent': full_location_path, 'queue': task_queue},
             retry=retry,
             timeout=timeout,
-            metadata=metadata,
+            metadata=metadata or (),

Review comment:
       I am not sure about that. For full readability this would require creating a new variable name, as modifying the parameter content may be ambiguous as some languages have special behavior. Luckily not in Python, but this can still arouse mixed feelings among polyglots, including mine. The new variable in this case would complicate the code unnecessarily.




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