File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1- from gevent import Greenlet
1+ from gevent import Greenlet , GreenletExit
22import datetime
33import logging
44import traceback
@@ -88,6 +88,11 @@ def wrapped(*args, **kwargs):
8888 try :
8989 self ._return_value = f (* args , ** kwargs )
9090 self ._status = "success"
91+ except (TaskKillException , GreenletExit ) as e :
92+ logging .error (e )
93+ # Set state to terminated
94+ self ._status = "terminated"
95+ self .progress = None
9196 except Exception as e : # skipcq: PYL-W0703
9297 logging .error (e )
9398 logging .error (traceback .format_exc ())
@@ -101,9 +106,6 @@ def wrapped(*args, **kwargs):
101106 def kill (self , exception = TaskKillException , block = True , timeout = None ):
102107 # Kill the greenlet
103108 Greenlet .kill (self , exception = exception , block = block , timeout = timeout )
104- # Set state to terminated
105- self ._status = "terminated"
106- self .progress = None
107109
108110 def terminate (self ):
109111 return self .kill ()
You can’t perform that action at this time.
0 commit comments