celery.loaders.base

celery.loaders.base

Loader base class.

class celery.loaders.base.BaseLoader(app, ***kwargs*)[源代码]

The base class for loaders.

Loaders handles,

  • Reading celery client/worker configurations.

  • What happens when a task starts?

See on_task_init().

  • What happens when the worker starts?

See on_worker_init().

  • What happens when the worker shuts down?

See on_worker_shutdown(). - What modules are imported to find tasks?

  • autodiscover_tasks(packages, related_name=’tasks’)
  • builtin_modules = frozenset([])
  • cmdline_config_parser(args, namespace=’celery’, re_type=<_sre.SRE_Pattern object at 0xc5df980>, extra_types={‘json’: }, override_types={‘dict’: ‘json’, ‘list’: ‘json’, ‘tuple’: ‘json’})[源代码]
  • conf None[源代码]

Loader configuration. - config_from_object(obj, silent=False)[源代码] - configured = False - find_module(module)[源代码] - import_default_modules()[源代码] - import_from_cwd(module, imp=None, package=None)[源代码] - import_module(module, package=None)[源代码] - import_task_module(module)[源代码] - init_worker()[源代码] - init_worker_process()[源代码] - mail None[源代码] - mail_admins(subject, body, fail_silently=False, sender=None, to=None, host=None, port=None, user=None, password=None, timeout=None, use_ssl=False, use_tls=False)[源代码] - now(utc=True)[源代码] - on_process_cleanup()[源代码]

This method is called after a task is executed. - on_task_init(task_id, task)[源代码]

This method is called before a task is executed. - on_worker_init()[源代码]

This method is called when the worker (celery worker) starts. - on_worker_process_init()[源代码]

This method is called when a child process starts. - on_worker_shutdown()[源代码]

This method is called when the worker (celery worker) shuts down. - override_backends = {} - read_configuration(env=’CELERY_CONFIG_MODULE’)[源代码] - shutdown_worker()[源代码] - worker_initialized = False