@@ -378,8 +378,7 @@ async def _process_completed_tasks(
378378 ):
379379 with log_catch (_logger , reraise = False ):
380380 task_can_be_cleaned , job_id = await future
381- if task_can_be_cleaned :
382- assert job_id is not None # nosec
381+ if task_can_be_cleaned and job_id :
383382 await client .release_task_result (job_id )
384383
385384 async def _handle_successful_run (
@@ -410,11 +409,9 @@ async def _handle_successful_run(
410409 async def _handle_computational_retrieval_error (
411410 self ,
412411 task : CompTaskAtDB ,
413- user_id : UserID ,
414412 result : ComputationalBackendTaskResultsNotReadyError ,
415413 log_error_context : dict [str , Any ],
416414 ) -> tuple [RunningState , SimcorePlatformStatus , list [ErrorDict ], bool ]:
417- assert task .job_id # nosec
418415 _logger .warning (
419416 ** create_troubleshooting_log_kwargs (
420417 f"Retrieval of task { task .job_id } result timed-out" ,
@@ -447,10 +444,7 @@ async def _handle_computational_retrieval_error(
447444 type = _TASK_RETRIEVAL_ERROR_TYPE ,
448445 ctx = {
449446 _TASK_RETRIEVAL_ERROR_CONTEXT_TIME_KEY : f"{ check_time } " ,
450- "user_id" : user_id ,
451- "project_id" : f"{ task .project_id } " ,
452- "node_id" : f"{ task .node_id } " ,
453- "job_id" : task .job_id ,
447+ ** log_error_context ,
454448 },
455449 )
456450 )
@@ -471,7 +465,6 @@ async def _handle_computational_backend_not_connected_error(
471465 result : ComputationalBackendNotConnectedError ,
472466 log_error_context : dict [str , Any ],
473467 ) -> tuple [RunningState , SimcorePlatformStatus , list [ErrorDict ], bool ]:
474- assert task .job_id # nosec
475468 _logger .warning (
476469 ** create_troubleshooting_log_kwargs (
477470 f"Computational backend disconnected when retrieving task { task .job_id } result" ,
@@ -491,8 +484,6 @@ async def _handle_task_error(
491484 result : BaseException ,
492485 log_error_context : dict [str , Any ],
493486 ) -> tuple [RunningState , SimcorePlatformStatus , list [ErrorDict ], bool ]:
494- assert task .job_id # nosec
495-
496487 # the task itself failed, check why
497488 if isinstance (result , TaskCancelledError ):
498489 _logger .info (
@@ -559,7 +550,7 @@ async def _process_task_result(
559550 task_errors ,
560551 task_completed ,
561552 ) = await self ._handle_computational_retrieval_error (
562- task .current , comp_run . user_id , result , log_error_context
553+ task .current , result , log_error_context
563554 )
564555 elif isinstance (result , ComputationalBackendNotConnectedError ):
565556 (
0 commit comments