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
2
2
import datetime
3
3
import logging
4
4
import traceback
@@ -88,6 +88,11 @@ def wrapped(*args, **kwargs):
88
88
try :
89
89
self ._return_value = f (* args , ** kwargs )
90
90
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
91
96
except Exception as e : # skipcq: PYL-W0703
92
97
logging .error (e )
93
98
logging .error (traceback .format_exc ())
@@ -101,9 +106,6 @@ def wrapped(*args, **kwargs):
101
106
def kill (self , exception = TaskKillException , block = True , timeout = None ):
102
107
# Kill the greenlet
103
108
Greenlet .kill (self , exception = exception , block = block , timeout = timeout )
104
- # Set state to terminated
105
- self ._status = "terminated"
106
- self .progress = None
107
109
108
110
def terminate (self ):
109
111
return self .kill ()
You can’t perform that action at this time.
0 commit comments