-
-
Notifications
You must be signed in to change notification settings - Fork 97
Fix Typos, Warn on Unmatching Brokers #423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Yooooo. That's really bad. Sorry for not thinking of this case. I should have created this warning earlier. This PR is amazing. Thanks for making it! |
s3rius
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes should fix the error.
Co-authored-by: Pavel Kirilin <[email protected]>
Co-authored-by: Pavel Kirilin <[email protected]>
|
Thanks @s3rius, I added one more check during task registration, which will throw a Lines 510 to 530 in 9f5cf43
|
|
Please run |
|
There are some weird things going on, where certain linters break the syntax and cause subsequent linters to fail 😬 Specifically it looks like add_trailing_commas is adding them in unwanted places and creating invalid python syntax |
taskiq/abc/broker.py
Outdated
| :param task: Decorated task. | ||
| """ | ||
| if task.broker != self: | ||
| raise TaskRejectedError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a syntax error. It's izulu. We use it for errors.
Please define separate error class for this error with
__template__ and broker argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Okay. Actually this PR is fine by me. So, I'm gonna merge it an fix on the main branch. |
* fix typos * warn if task broker doesn't match self * oopsie * Update taskiq/schedule_sources/label_based.py Co-authored-by: Pavel Kirilin <[email protected]> * Update taskiq/schedule_sources/label_based.py Co-authored-by: Pavel Kirilin <[email protected]> * raise error on broker mismatch * ruffed * create new error class --------- Co-authored-by: Pavel Kirilin <[email protected]>
* fix typos * warn if task broker doesn't match self * oopsie * Update taskiq/schedule_sources/label_based.py Co-authored-by: Pavel Kirilin <[email protected]> * Update taskiq/schedule_sources/label_based.py Co-authored-by: Pavel Kirilin <[email protected]> * raise error on broker mismatch * ruffed * create new error class --------- Co-authored-by: Pavel Kirilin <[email protected]>


Hi all, thanks for making this repo; it's really useful.
This PR fixes some typos and also adds a warning when a scheduled task's broker doesn't match the broker it's being executed on. This has fucked me over several times when scheduled tasks are registered but silently fail to execute. This was my own fault since I was double-registering tasks. But it's a nasty pitfall.
Should we detect mismatched brokers a bit sooner, i.e. when the task is first registered? Probably if a user tries to register a function that's already an instance of a decorated task, we should throw an error if the brokers don't match.