Events
Service used for sending monitoring events.
Attributes
| Attribute | Type | Description |
|---|---|---|
| requires | tuple = (Connection,) | Tuple of bootstep classes that must be initialized before the Events service can start. |
| groups | list = None | List of event group names to be dispatched, such as 'worker' or 'task', used to filter which events are sent. |
| send_events | boolean | Boolean flag indicating if the service is configured to transmit any event types based on task, gossip, or heartbeat settings. |
| enabled | boolean | Toggle that determines if the event dispatcher should actively process and send events. |
Constructor
Signature
def Events(
c: Any,
task_events: boolean = True,
without_heartbeat: boolean = False,
without_gossip: boolean = False,
**kwargs: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| c | Any | The consumer or parent object context. |
| task_events | boolean = True | Flag to enable task-related events. |
| without_heartbeat | boolean = False | Flag to disable heartbeat events. |
| without_gossip | boolean = False | Flag to disable gossip events. |
| **kwargs | dict | Additional keyword arguments passed to the parent class constructor. |
Methods
start()
@classmethod
def start(
c: [Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)
) - > null
Initializes and starts the event dispatcher to begin sending monitoring events. This method flushes any events buffered while the connection was down and configures the dispatcher with the current worker hostname and event groups.
Parameters
| Name | Type | Description |
|---|---|---|
| c | [Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer) | The consumer instance providing the application context and connection for the event dispatcher. |
Returns
| Type | Description |
|---|---|
null |
stop()
@classmethod
def stop(
c: [Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)
) - > null
Stops the event service; currently implemented as a no-op as teardown is handled during shutdown.
Parameters
| Name | Type | Description |
|---|---|---|
| c | [Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer) | The consumer instance associated with this step. |
Returns
| Type | Description |
|---|---|
null |
shutdown()
@classmethod
def shutdown(
c: [Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer)
) - > null
Performs a clean shutdown of the event service by closing the dispatcher and releasing network resources.
Parameters
| Name | Type | Description |
|---|---|---|
| c | [Consumer](../consumer/consumer.md?sid=celery_worker_consumer_consumer_consumer) | The consumer instance whose event resources should be released. |
Returns
| Type | Description |
|---|---|
null |