swh.scheduler.task module

swh.scheduler.task.ts()[source]
class swh.scheduler.task.SWHTask[source]

Bases: celery.app.task.Task

a schedulable task (abstract class)

Current implementation is based on Celery. See http://docs.celeryproject.org/en/latest/reference/celery.app.task.html for how to use tasks once instantiated

property statsd
on_failure(exc, task_id, args, kwargs, einfo)[source]

Error handler.

This is run by the worker when the task fails.

Parameters
  • exc (Exception) – The exception raised by the task.

  • task_id (str) – Unique id of the failed task.

  • args (Tuple) – Original arguments for the task that failed.

  • kwargs (Dict) – Original keyword arguments for the task that failed.

  • einfo (ExceptionInfo) – Exception information.

Returns

The return value of this handler is ignored.

Return type

None

on_success(retval, task_id, args, kwargs)[source]

Success handler.

Run by the worker if the task executes successfully.

Parameters
  • retval (Any) – The return value of the task.

  • task_id (str) – Unique id of the executed task.

  • args (Tuple) – Original arguments for the executed task.

  • kwargs (Dict) – Original keyword arguments for the executed task.

Returns

The return value of this handler is ignored.

Return type

None

property log
run(*args, **kwargs)[source]

The body of the task executed by workers.

ignore_result = False
priority = None
rate_limit = None
reject_on_worker_lost = None
request_stack = <celery.utils.threads._LocalStack object>
serializer = 'msgpack'
store_errors_even_if_ignored = False
track_started = True
typing = True