WorkerComponent
Bootstep that starts the autoscaler thread/timer in the worker.
Attributes
| Attribute | Type | Description |
|---|---|---|
| label | string = Autoscaler | Internal identifier used for logging and reporting the status of the autoscaler bootstep. |
| conditional | boolean = True | Flag indicating that the step is only enabled if specific conditions are met during worker startup. |
| requires | tuple = (Pool,) | Sequence of other bootsteps or components that must be initialized before the autoscaler can start. |
Constructor
Signature
def WorkerComponent(
w: Any,
**kwargs: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| w | Any | The worker instance being initialized. |
| **kwargs | dict | Additional keyword arguments. |
Signature
def WorkerComponent(
w: [Worker](../../events/state/worker.md?sid=celery_events_state_worker),
kwargs: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| w | [Worker](../../events/state/worker.md?sid=celery_events_state_worker) | The worker instance being initialized. |
| kwargs | dict | Additional keyword arguments passed during bootstep initialization. |
Methods
create()
@classmethod
def create(
w: [Worker](../../events/state/worker.md?sid=celery_events_state_worker)
) - > Autoscaler|null
Instantiates the autoscaler using the worker's configuration and assigns it to the worker instance.
Parameters
| Name | Type | Description |
|---|---|---|
| w | [Worker](../../events/state/worker.md?sid=celery_events_state_worker) | The worker instance for which the autoscaler is being created. |
Returns
| Type | Description |
|---|---|
| `Autoscaler | null` |
register_with_event_loop()
@classmethod
def register_with_event_loop(
w: [Worker](../../events/state/worker.md?sid=celery_events_state_worker),
hub: [Hub](../components/hub.md?sid=celery_worker_components_hub)
) - > null
Integrates the autoscaler with the worker's event loop by attaching scaling logic to task messages and periodic keepalive checks.
Parameters
| Name | Type | Description |
|---|---|---|
| w | [Worker](../../events/state/worker.md?sid=celery_events_state_worker) | The worker instance containing the consumer and autoscaler. |
| hub | [Hub](../components/hub.md?sid=celery_worker_components_hub) | The event loop hub used to schedule repeated scaling checks. |
Returns
| Type | Description |
|---|---|
null |
info()
@classmethod
def info(
w: [Worker](../../events/state/worker.md?sid=celery_events_state_worker)
) - > dict
Return Autoscaler info.
Parameters
| Name | Type | Description |
|---|---|---|
| w | [Worker](../../events/state/worker.md?sid=celery_events_state_worker) | The worker instance from which to retrieve autoscaler information. |
Returns
| Type | Description |
|---|---|
dict | A dictionary containing the current status and metadata of the worker's autoscaler. |