ferruzzi commented on code in PR #73294:
URL: https://github.com/apache/airflow/pull/73294#discussion_r4051183067
##########
task-sdk/src/airflow/sdk/definitions/deadline.py:
##########
@@ -154,14 +154,22 @@ def __init__(
callback: Callback,
name: str | None = None,
):
+ if not isinstance(interval, (timedelta, VariableInterval)):
+ raise ValueError(
+ f"Interval must be a `timedelta` or a `VariableInterval`,
received {type(interval).__name__}."
+ )
+
+ # Serializing blocks subclasses for security reasons, so isinstance is
too loose.
+ if type(callback) not in {AsyncCallback, SyncCallback}:
+ raise ValueError(
+ f"Callbacks must be `AsyncCallback` or `SyncCallback`,
received {type(callback).__name__}."
+ )
Review Comment:
I had meant to include `SerializedVariableInterval` as an allowed type and
missed it, but I think you are right about it being the worse option. I don't
generally like removing tests to make something work, but I think I can tweak
your test in a way that makes it more useful while also not blocking mine. let
me know what you think.
--
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]