ashb commented on a change in pull request #18112:
URL: https://github.com/apache/airflow/pull/18112#discussion_r705397511



##########
File path: airflow/exceptions.py
##########
@@ -256,12 +278,21 @@ def __init__(
         self.method_name = method_name
         self.kwargs = kwargs
         self.timeout = timeout
+
         # Check timeout type at runtime
         if self.timeout is not None and not hasattr(self.timeout, 
"total_seconds"):
             raise ValueError("Timeout value must be a timedelta")
 
+        # Check keyword arguments
+        if kwargs:
+            if method_name is None:
+                raise ValueError("Keyword arguments not allowed when method is 
not specified")

Review comment:
       Why not  just default `method_name: str = 'execute'` instead?

##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -533,7 +533,7 @@ def _process_executor_events(self, session: Session = None) 
-> int:
         return len(event_buffer)
 
     def _execute(self) -> None:
-        self.log.info("Starting the scheduler")
+        self.log.info("Starting the scheduler: %r", self.executor)

Review comment:
       Please avoid making changes to unrelated files in PRs.

##########
File path: airflow/exceptions.py
##########
@@ -256,12 +278,21 @@ def __init__(
         self.method_name = method_name
         self.kwargs = kwargs
         self.timeout = timeout
+
         # Check timeout type at runtime
         if self.timeout is not None and not hasattr(self.timeout, 
"total_seconds"):
             raise ValueError("Timeout value must be a timedelta")
 
+        # Check keyword arguments
+        if kwargs:
+            if method_name is None:
+                raise ValueError("Keyword arguments not allowed when method is 
not specified")
+            else:
+                if "event" in kwargs:
+                    raise ValueError("Keyword argument must not contain 
reserved name 'event'")

Review comment:
       Shouldn't this  apply no mater what the method_name is?




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