climate_ref_celery.cli
#
Managing remote celery workers
This module is used to manage remote execution workers for the Climate REF project.
It is added to the ref command line interface if the climate-ref-celery package is installed.
A celery worker should be run for each diagnostic provider.
import_provider(provider_name)
#
Import the provider using the name of a registered provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider_name
|
str
|
The name of a registered provider. Packages can register a provider by defining an
entry point
in its Example: 'climate_ref_esmvaltool:provider' would require a section in the
If the entry point is not found, an error will be raised and the list of available providers will be shown. |
required |
Raises:
| Type | Description |
|---|---|
Abort
|
If the provider_package does not define a 'provider' variable If the provider_package is not found |
Returns:
| Type | Description |
|---|---|
DiagnosticProvider
|
The provider instance |
Source code in packages/climate-ref-celery/src/climate_ref_celery/cli.py
list_config()
#
List the celery configuration
start_worker(ctx, loglevel=typer.Option('info', help='Log level for the worker'), provider=typer.Option(help='Name of the provider to start a worker for. This argument may be supplied multiple times. If no provider is given, the worker will consume the default queue.', default=None), package=typer.Option(help='Deprecated. Use provider instead', default=None), extra_args=typer.Argument(None, help='Additional arguments for the worker'))
#
Start a Celery worker for the given provider.
A celery worker enables the execution of tasks in the background on multiple different nodes. This worker will register a celery task for each diagnostic in the provider. The worker tasks can be executed by sending a celery task with the name '{package_slug}_{diagnostic_slug}'.
Providers must be registered as entry points in the pyproject.toml file of the package.
The entry point should be defined under the group climate-ref.providers
(See import_provider for details).