MCPcopy
hub / github.com/celery/celery / time_limit

Function time_limit

celery/worker/control.py:299–319  ·  view source on GitHub ↗

Tell worker(s) to modify the time limit for task by type. Arguments: task_name (str): Name of task to change. hard (float): Hard time limit. soft (float): Soft time limit.

(state, task_name=None, hard=None, soft=None, **kwargs)

Source from the content-addressed store, hash-verified

297 signature='<task_name> <soft_secs> [hard_secs]',
298)
299def time_limit(state, task_name=None, hard=None, soft=None, **kwargs):
300 """Tell worker(s) to modify the time limit for task by type.
301
302 Arguments:
303 task_name (str): Name of task to change.
304 hard (float): Hard time limit.
305 soft (float): Soft time limit.
306 """
307 try:
308 task = state.app.tasks[task_name]
309 except KeyError:
310 logger.error('Change time limit attempt for unknown task %s',
311 task_name, exc_info=True)
312 return nok('unknown task')
313
314 task.soft_time_limit = soft
315 task.time_limit = hard
316
317 logger.info('New time limits for tasks of type %s: soft=%s hard=%s',
318 task_name, soft, hard)
319 return ok('time limits set successfully')
320
321
322# -- Events

Callers

nothing calls this directly

Calls 4

nokFunction · 0.85
okFunction · 0.85
errorMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected