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/08/19 12:19:46 UTC

[GitHub] [airflow] turbaszek commented on a change in pull request #10403: Fix duration object in Dataproc cluster generator

turbaszek commented on a change in pull request #10403:
URL: https://github.com/apache/airflow/pull/10403#discussion_r472985198



##########
File path: airflow/providers/google/cloud/operators/dataproc.py
##########
@@ -289,26 +289,24 @@ def _build_gce_cluster_config(self, cluster_data):
     def _build_lifecycle_config(self, cluster_data):
         if self.idle_delete_ttl:
             cluster_data['config']['lifecycle_config']['idle_delete_ttl'] = \
-                "{}s".format(self.idle_delete_ttl)
+                {"seconds": self.idle_delete_ttl}
 
         if self.auto_delete_time:
             utc_auto_delete_time = timezone.convert_to_utc(self.auto_delete_time)
             cluster_data['config']['lifecycle_config']['auto_delete_time'] = \
                 utc_auto_delete_time.strftime('%Y-%m-%dT%H:%M:%S.%fZ')
         elif self.auto_delete_ttl:
             cluster_data['config']['lifecycle_config']['auto_delete_ttl'] = \
-                "{}s".format(self.auto_delete_ttl)
+                {"seconds": self.auto_delete_ttl}
 
         return cluster_data
 
     def _build_cluster_data(self):
         if self.zone:
             master_type_uri = \
-                "https://www.googleapis.com/compute/v1/projects/{}/zones/{}/machineTypes/{}".format(
-                    self.project_id, self.zone, self.master_machine_type)
+                f"projects/{self.project_id}/zones/{self.zone}/machineTypes/{self.master_machine_type}"
             worker_type_uri = \
-                "https://www.googleapis.com/compute/v1/projects/{}/zones/{}/machineTypes/{}".format(
-                    self.project_id, self.zone, self.worker_machine_type)
+                f"projects/{self.project_id}/zones/{self.zone}/machineTypes/{self.worker_machine_type}"

Review comment:
       Not related but simplifies things. Reference:
   >Optional. The Compute Engine machine type used for cluster instances.
   >A full URL, partial URI, or short name are valid. Examples:
   > - https://www.googleapis.com/compute/v1/projects/[projectId]/zones/us-east1-a/machineTypes/n1-standard-2
   > - projects/[projectId]/zones/us-east1-a/machineTypes/n1-standard-2
   > - n1-standard-2




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