Celery event creation, formatting, and publishing to the celeryev topic exchange
(ported from celery.events and celery.events.dispatcher).
Emits worker (worker-online, worker-heartbeat, worker-offline) and task lifecycle
events (task-received, task-started, task-succeeded, task-failed, task-retried,
task-revoked) compatible with Flower, celery.events.EventReceiver, and OpenRelik Mediator.
Summary
Functions
Builds a Celery event dictionary matching celery.events.Event.
Returns the celeryev exchange (durable: true).
Matches Python Celery's celery.events.event.get_exchange/2, which switches
the exchange type from "topic" to "fanout" when Redis is used as the transport.
Returns the OS PID as an integer.
Publishes a Celery event to the celeryev exchange on channel_or_conn.
Default software identity metadata included in worker-online, worker-heartbeat,
and worker-offline events.
Formats an Elixir value as a Python literal string (repr()), suitable for
Python's ast.literal_eval/1 (e.g. inspect().registered("metadata") in OpenRelik
and args/kwargs/result in Flower).
Functions
Builds a Celery event dictionary matching celery.events.Event.
Converts "worker-online" into routing key "worker.online", attaches standard
metadata (hostname, timestamp, utcoffset, pid, clock, local_received),
and merges fields.
@spec exchange(term()) :: Kombu.Exchange.t()
Returns the celeryev exchange (durable: true).
Matches Python Celery's celery.events.event.get_exchange/2, which switches
the exchange type from "topic" to "fanout" when Redis is used as the transport.
@spec os_pid() :: pos_integer()
Returns the OS PID as an integer.
Publishes a Celery event to the celeryev exchange on channel_or_conn.
@spec sw_info() :: map()
Default software identity metadata included in worker-online, worker-heartbeat,
and worker-offline events.
Formats an Elixir value as a Python literal string (repr()), suitable for
Python's ast.literal_eval/1 (e.g. inspect().registered("metadata") in OpenRelik
and args/kwargs/result in Flower).