worker.state

Internal worker state (global).

This includes the currently active and reserved tasks, statistics, and revoked tasks.

Module Contents

Classes

Persistent(self,state,filename,clock=None) Stores worker state between restarts.

Functions

reset_state()
maybe_shutdown() Shutdown if flags have been set.
task_reserved(request) Called when a task is reserved by the worker.
task_accepted(request,_all_total_count=all_total_count,add_active_request=None,add_to_total_count=None) Update global state when a task has been accepted.
task_ready(request) Called when a task is completed.
on_shutdown()
task_reserved(request) Called when a task is reserved by the worker.
task_ready(request) Called when a task is completed.
reset_state()
maybe_shutdown()

Shutdown if flags have been set.

task_reserved(request, add_request=None, add_reserved_request=None)

Update global state when a task has been reserved.

task_accepted(request, _all_total_count=all_total_count, add_active_request=None, add_to_total_count=None)

Update global state when a task has been accepted.

task_ready(request, remove_request=None, discard_active_request=None, discard_reserved_request=None)

Update global state when a task is ready.

on_shutdown()
task_reserved(request)

Called when a task is reserved by the worker.

task_ready(request)

Called when a task is completed.

class Persistent(state, filename, clock=None)

Stores worker state between restarts.

This is the persistent data stored by the worker when celery worker --statedb is enabled.

Currently only stores revoked task id’s.

__init__(state, filename, clock=None)
open()
merge()
sync()
close()
save()
_merge_with(d)
_sync_with(d)
_merge_clock(d)
_merge_revoked(d)
_merge_revoked_v3(zrevoked)
_merge_revoked_v2(saved)
_merge_revoked_v1(saved)
_dumps(obj)
_revoked_tasks()
db()