kaxil commented on a change in pull request #15389:
URL: https://github.com/apache/airflow/pull/15389#discussion_r638917089
##########
File path: airflow/exceptions.py
##########
@@ -225,3 +226,30 @@ def __str__(self):
class ConnectionNotUnique(AirflowException):
"""Raise when multiple values are found for the same conn_id"""
+
+
+class TaskDeferred(BaseException):
+ """
+ Special exception raised to signal that the operator it was raised from
+ wishes to defer until a trigger fires.
+ """
+
+ def __init__(
+ self,
+ *,
+ trigger,
+ method_name: str,
+ kwargs: Optional[Dict[str, Any]] = None,
+ timeout: Optional[datetime.timedelta] = None,
+ ):
+ super().__init__()
+ self.trigger = trigger
+ 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")
Review comment:
Should be fine -- was just curious
--
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:
[email protected]