@@ -1042,18 +1042,23 @@ async def _attach_volumes(
10421042 )
10431043 job_runtime_data .volume_names .append (volume .name )
10441044 break # attach next mount point
1045- except ( ServerClientError , BackendError ) as e :
1046- logger .warning ("%s: failed to attached volume: %s" , fmt (job_model ), repr (e ))
1045+ except ServerClientError as e :
1046+ logger .info ("%s: failed to attach volume: %s" , fmt (job_model ), repr (e ))
10471047 job_model .termination_reason = JobTerminationReason .VOLUME_ERROR
1048- job_model .termination_reason_message = "Failed to attach volume"
1048+ job_model .termination_reason_message = f"Failed to attach volume: { e .msg } "
1049+ switch_job_status (session , job_model , JobStatus .TERMINATING )
1050+ except BackendError as e :
1051+ logger .warning ("%s: failed to attach volume: %s" , fmt (job_model ), repr (e ))
1052+ job_model .termination_reason = JobTerminationReason .VOLUME_ERROR
1053+ job_model .termination_reason_message = f"Failed to attach volume: { str (e )} "
10491054 switch_job_status (session , job_model , JobStatus .TERMINATING )
10501055 except Exception :
10511056 logger .exception (
10521057 "%s: got exception when attaching volume" ,
10531058 fmt (job_model ),
10541059 )
10551060 job_model .termination_reason = JobTerminationReason .VOLUME_ERROR
1056- job_model .termination_reason_message = "Failed to attach volume"
1061+ job_model .termination_reason_message = "Failed to attach volume: unexpected error "
10571062 switch_job_status (session , job_model , JobStatus .TERMINATING )
10581063 finally :
10591064 job_model .job_runtime_data = job_runtime_data .json ()
@@ -1075,6 +1080,8 @@ async def _attach_volume(
10751080 raise ServerClientError ("Cannot attach a deleted volume" )
10761081 if volume_model .to_be_deleted :
10771082 raise ServerClientError ("Cannot attach a volume marked for deletion" )
1083+ if volume_model .lock_expires_at is not None :
1084+ raise ServerClientError ("Cannot attach a volume locked for processing" )
10781085 attachment_data = await common_utils .run_async (
10791086 compute .attach_volume ,
10801087 volume = volume ,
0 commit comments