Oleg K <windspi...@gmail.com> added the comment:

What is an "advanced" task?  
Why CancelledError is not enough?  
What's the actual use case?
----------------------

for instance, i want to create a task which is responsible for 
controlling a "slow resource" that should accessed carefully not to DOS it,  
that could be an long running api call,
or report generation procedure, or slow sqlite query.

that task may be interrupted when program needs to respond quickly 
for example UI is requesting another action with that slow resource, 
that should happen asap. 

if i could throw custom exception, that task would  suspend or interrupt 
current action, then execute something new and urgent, and then continue
where it left of. 
-----------------------------------------------------

also there is another case i have in mind, 

there is a task which monitors video stream with different means to see if that 
stream is alive an fine, it uses external calls to ffmpeg to check how the 
stream is doing,  -  that monitoring procedure is continuous always running 
task, 

sometimes there is a network problem or one of CDN servers go down,
when that event is happening i need to throw custom exception to that
 "monitoring task" no matter at which stage it is at.  

when that task will get custom exception it will not exit but will switch to 
different operation mode, it should not exit because the monitoring is 
continuous process ,
it just hast to interpret its measurements differently, and use different ways 
to measure video state.


---

I hope i made clear examples, lmk if you need more details.
thanks!

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32104>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to