jedcunningham commented on a change in pull request #16765:
URL: https://github.com/apache/airflow/pull/16765#discussion_r662639162



##########
File path: tests/models/test_baseoperator.py
##########
@@ -109,6 +109,11 @@ def test_incorrect_default_args(self):
         with pytest.raises(AirflowException, 
match='Argument.*test_param.*required'):
             DummyClass(default_args=default_args)
 
+    def test_incorrect_priority_weight(self):
+        error_msg = "`priority_weight` for task: 'test_op' only accepts 
integers, <class 'str'> provided: 2."

Review comment:
       ```suggestion
           error_msg = "`priority_weight` for task 'test_op' only accepts 
integers, received '<class 'str'>'."
   ```

##########
File path: airflow/models/baseoperator.py
##########
@@ -590,10 +590,16 @@ def __init__(
             if isinstance(max_retry_delay, timedelta):
                 self.max_retry_delay = max_retry_delay
             else:
-                self.log.debug("Max_retry_delay isn't timedelta object, 
assuming secs")
+                self.log.debug("max_retry_delay isn't timedelta object, 
assuming secs")
                 self.max_retry_delay = timedelta(seconds=max_retry_delay)
 
         self.params = params or {}  # Available in templates!
+        if priority_weight:
+            if not isinstance(priority_weight, int):
+                raise AirflowException(
+                    f"`priority_weight` for task: '{self.task_id}' only 
accepts integers, "
+                    f"{type(priority_weight)} provided: {priority_weight}."

Review comment:
       ```suggestion
                       f"`priority_weight` for task: '{self.task_id}' only 
accepts integers, "
                       f"received '{type(priority_weight)}'."
   ```




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to