-
Notifications
You must be signed in to change notification settings - Fork 91
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
Deprecating stop_task: A Discussion #59
Comments
I think you lay out a compelling case and I'm happy to deprecate/remove support for it. It's not a feature that I've ever had the need for, and I just merged in the enhancement since it seemed to be useful to others. Re-reading that PR, it does seem like the core use case of providing input on a failure within the task is better handled through the ways you've outlined. |
The first time I used celery-progress, I got confused with |
If we choose to keep def stop_task(exc):
raise (exc if isinstance(exc, Exception) else Exception(exc)) This would have the exact same effect as the what the previous implementation aimed to accomplish, with the caveat that the bar would still go to 100%. In order for us to maintain the current state of the progress bar vs filling it completely, we would have to make changes to the client-side JavaScript to somehow interpret that from the response, and we would have to modify how In the end, all of this is just extra work to offer a crutch for actually just raising the error yourself. Heck, it even takes more characters to type |
Although, for a possible counter-argument, keeping |
@EJH2 you have my support on whatever you think makes sense on this 😄 Sorry if I'm acting a bit hands off - I just don't have any strong opinions on this particular topic. Plus, I think you're doing a great job stewarding the lib and trust your judgment. |
I'm in favour of dropping The only use case for |
Another thought that came to my mind, |
It seems that the general consensus is fine with removing the method, so I'll put out a PR that corrects this. |
Since it's inception,
stop_task
(in my opinion) has sat in a rather weird place:Exception(exception_message_string)
or the like instead?stop_task
doesn't actually stop the task on it's own, you HAVE to raise an exception anyways for it to stop. Allstop_task
does is tell any currently running bars to stop listening.stop_task
call (see Unsupported states crash Progress reporting #54).Ignore
exception raise inside ofstop_task
, and pass it metadata that the post-run handler can try to decipher whether theIgnore
exception means "Ignore", or "We actually mean FAILURE but we'd rather do it the hard way instead". This would require having to type-check every result that passes through the handler, and if it's anIgnore
exception, look to see if specific metadata is present to then change the state and result to send to the progress bar. However, what's the point of doing that vs. actually just raising the error in the first place?stop_task
may have been a great idea at the time, but I feel that it's rather antiquated for the reasons listed above. Obviously, this would be a breaking change, so that must be taken into consideration. @czue @OmarWKH thoughts?The text was updated successfully, but these errors were encountered: