loaders.base

Loader base class.

Module Contents

Classes

BaseLoader(self,app,**kwargs) Base class for loaders.

Functions

autodiscover_tasks(packages,related_name=”tasks”)
find_related_module(package,related_name) Find module in package.
class BaseLoader(app, **kwargs)

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?
__init__(app, **kwargs)
now(utc=True)
on_task_init(task_id, task)

Called before a task is executed.

on_process_cleanup()

Called after a task is executed.

on_worker_init()

Called when the worker (celery worker) starts.

on_worker_shutdown()

Called when the worker (celery worker) shuts down.

on_worker_process_init()

Called when a child process starts.

import_task_module(module)
import_module(module, package=None)
import_from_cwd(module, imp=None, package=None)
import_default_modules()
init_worker()
shutdown_worker()
init_worker_process()
config_from_object(obj, silent=False)
_smart_import(path, imp=None)
_import_config_module(name)
find_module(module)
cmdline_config_parser(args, namespace="celery", re_type=compile, extra_types=dict, override_types=dict)
read_configuration(env="CELERY_CONFIG_MODULE")
autodiscover_tasks(packages, related_name="tasks")
default_modules()
conf()

Loader configuration.

autodiscover_tasks(packages, related_name="tasks")

Find module in package.