airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] potiuk commented on a change in pull request #6749: [AIRFLOW-6193] Do not use asserts in Airflow main code
Date Sun, 08 Dec 2019 09:38:18 GMT
potiuk commented on a change in pull request #6749: [AIRFLOW-6193] Do not use asserts in Airflow
main code
URL: https://github.com/apache/airflow/pull/6749#discussion_r355172781
 
 

 ##########
 File path: airflow/providers/google/cloud/operators/dataproc.py
 ##########
 @@ -232,12 +232,11 @@ def __init__(self,
         self.customer_managed_key = customer_managed_key
         self.single_node = num_workers == 0
 
-        assert not (self.custom_image and self.image_version), \
-            "custom_image and image_version can't be both set"
+        if self.custom_image and self.image_version:
+            raise ValueError("The custom_image and image_version can't be both set")
 
-        assert (
-            not self.single_node or (self.single_node and self.num_preemptible_workers ==
0)
-        ), "num_workers == 0 means single node mode - no preemptibles allowed"
+        if self.num_preemptible_workers == 0 and not self.single_node:
+            raise ValueError("num_workers == 0 means single node mode - no preemptibles allowed")
 
 Review comment:
   I will change it and also update the error message because it is really confusing :)

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

Mime
View raw message