File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -323,3 +323,16 @@ class ReplicateError(PulpException):
323323
324324 def __str__ (self ):
325325 return f"[{ self .error_code } ] " + _ ("Replication failed" )
326+
327+
328+ class TaskTimeoutError (PulpException ):
329+ """
330+ Raised when an immediate task took too long.
331+ """
332+
333+ error_code = "PLP0019"
334+
335+ def __str__ (self , task , timeout ):
336+ return f"[{ self .error_code } ] " + _ (
337+ "Immediate task {task} timed out after {timeout} seconds."
338+ ).format (task = task , timeout = timeout )
Original file line number Diff line number Diff line change 3030 TASK_WAKEUP_HANDLE ,
3131 TASK_WAKEUP_UNBLOCK ,
3232)
33- from pulpcore .exceptions .base import PulpException , InternalErrorException
33+ from pulpcore .exceptions .base import PulpException , InternalErrorException , TaskTimeoutError
3434from pulp_glue .common .exceptions import PulpException as PulpGlueException
3535
3636from pulpcore .middleware import x_task_diagnostics_var
@@ -223,10 +223,7 @@ async def _wrapper():
223223 try :
224224 return await asyncio .wait_for (coro_fn (), timeout = IMMEDIATE_TIMEOUT )
225225 except asyncio .TimeoutError :
226- msg_template = "Immediate task %s timed out after %s seconds."
227- error_msg = msg_template % (task_pk , IMMEDIATE_TIMEOUT )
228- _logger .info (error_msg )
229- raise RuntimeError (error_msg )
226+ raise TaskTimeoutError (task , timeout = IMMEDIATE_TIMEOUT )
230227
231228 return _wrapper
232229
You can’t perform that action at this time.
0 commit comments