Can end task instance from trigger#31808
Conversation
With this change, if desired, we can avoid having to resume the task on a worker. We can end the task (in states success, failed, or skipped) from the trigger itself. Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
a48edbb to
d62624d
Compare
| def __init__(self, *, xcom_return: Any | None = None, other_xcom: dict[str, Any] | None = None, **kwargs): | ||
| if "payload" in kwargs: | ||
| raise ValueError("Param 'payload' not supported for this class.") |
There was a problem hiding this comment.
Why is this needed? I imagine this should work:
| def __init__(self, *, xcom_return: Any | None = None, other_xcom: dict[str, Any] | None = None, **kwargs): | |
| if "payload" in kwargs: | |
| raise ValueError("Param 'payload' not supported for this class.") | |
| def __init__(self, *, xcom_return: Any | None = None, other_xcom: dict[str, Any] | None = None) -> None: |
There was a problem hiding this comment.
Because the payload is determined by the state / controlled by the class. User should not submit a payload.
There was a problem hiding this comment.
if we do not check, user might pass payload and it would be silently ignored
There was a problem hiding this comment.
I don’t think so? The suggested change removed payload altogether and should raise TypeError when it is provided. Or is the issue you want to allow **kwargs? But I don’t see any subclass using that either.
There was a problem hiding this comment.
Ah i see what you're saying... Well it's in the base class. Would you not say it's probably a good idea to include kwargs in the subclasses for future compat?
|
ok made all changes except checking for user-supplied 'payload' |
|
marking this draft for now because we have to deal with callbacks and email |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
With this change, if desired, we can avoid having to resume the task on a worker. We can end the task (in states success, failed, or skipped) from the trigger itself.
Closes: #31718
cc @Lee-W