Remote control and inspection commands for Celery workers over Kombu.Pidbox
(ported from celery.worker.control and celery.app.control).
Supports standard Celery control/inspect methods:
ping->%{"ok" => "pong"}registered-> list of registered task names (with optional[metadata=...]whentaskinfoitemsis requested)active-> list of currently executing task request info mapsreserved-> list of prefetched/reserved task request info mapsscheduled-> list of ETA-scheduled task mapsrevoked-> list of revoked task IDsactive_queues-> list of queue dictionaries consumed by the workerconf-> worker configuration dictionarystats-> worker statistics dictionaryreport-> worker software/environment reportenable_events/disable_events-> toggles event emissionheartbeat-> triggers an immediate worker heartbeatrevoke-> revokes one or moretask_idsshutdown-> stops the worker gracefully
Summary
Functions
Broadcasts a control/inspect command to workers via Kombu.Pidbox.
Builds the handler map used by a Celery.Worker's Kombu.Pidbox.Node to respond to
remote control and inspect requests from Python or Elixir Celery clients.
Formats a worker's %Kombu.Queue{} list into the dictionary list expected by
Flower and inspect().active_queues().
Formats registered tasks for inspect.registered, supporting taskinfoitems
(such as ["metadata"] used by OpenRelik's inspect().registered("metadata")).
Broadcasts an inspect command and collects replies from workers via Kombu.Pidbox.
Creates a %Kombu.Pidbox.Mailbox{} (type: "fanout") for the given %Celery{} or %Celery.Config{}.
Pings active workers via Kombu.Pidbox and collects replies.
Broadcasts a revoke command for task_id (or a list of task IDs) to workers.
Functions
@spec broadcast(Celery.t() | Celery.Config.t(), String.t(), map(), keyword()) :: :ok | list() | {:ok, list()} | {:error, term()}
Broadcasts a control/inspect command to workers via Kombu.Pidbox.
Builds the handler map used by a Celery.Worker's Kombu.Pidbox.Node to respond to
remote control and inspect requests from Python or Elixir Celery clients.
@spec format_active_queues([Kombu.Queue.t()]) :: [map()]
Formats a worker's %Kombu.Queue{} list into the dictionary list expected by
Flower and inspect().active_queues().
Formats registered tasks for inspect.registered, supporting taskinfoitems
(such as ["metadata"] used by OpenRelik's inspect().registered("metadata")).
Broadcasts an inspect command and collects replies from workers via Kombu.Pidbox.
@spec mailbox(Celery.t() | Celery.Config.t()) :: Kombu.Pidbox.Mailbox.t()
Creates a %Kombu.Pidbox.Mailbox{} (type: "fanout") for the given %Celery{} or %Celery.Config{}.
@spec ping(Celery.t() | Celery.Config.t(), keyword()) :: [map()]
Pings active workers via Kombu.Pidbox and collects replies.
@spec revoke(Celery.t() | Celery.Config.t(), String.t() | [String.t()], keyword()) :: :ok | list() | {:ok, list()} | {:error, term()}
Broadcasts a revoke command for task_id (or a list of task IDs) to workers.