File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
plain-worker/plain/worker Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -235,17 +235,25 @@ def rescue_job_results(self):
235
235
def future_finished_callback (job_uuid : str , future : Future ):
236
236
if future .cancelled ():
237
237
logger .warning ("Job cancelled job_uuid=%s" , job_uuid )
238
- job = Job .objects .get (uuid = job_uuid )
239
- job .convert_to_result (status = JobResultStatuses .CANCELLED )
240
- elif future .exception ():
241
- # This is an uncaught error in running process_job,
242
- # which is likely an internal bug. Not sure if it should be marked as a failure and retried?
243
- exception = future .exception ()
244
- logger .exception (
245
- "process_job failed job_uuid=%s" ,
238
+ try :
239
+ job = Job .objects .get (uuid = job_uuid )
240
+ job .convert_to_result (status = JobResultStatuses .CANCELLED )
241
+ except Job .DoesNotExist :
242
+ # Job may have already been cleaned up
243
+ pass
244
+ elif exception := future .exception ():
245
+ # Process pool may have been killed...
246
+ logger .warning (
247
+ "Job failed job_uuid=%s" ,
246
248
job_uuid ,
247
249
exc_info = exception ,
248
250
)
251
+ try :
252
+ job = Job .objects .get (uuid = job_uuid )
253
+ job .convert_to_result (status = JobResultStatuses .CANCELLED )
254
+ except Job .DoesNotExist :
255
+ # Job may have already been cleaned up
256
+ pass
249
257
else :
250
258
logger .debug ("Job finished job_uuid=%s" , job_uuid )
251
259
You can’t perform that action at this time.
0 commit comments