Skip to content

cmem_client.repositories.schedulers¤

Repository for the workflow schedulers of DataIntegration.

Provides SchedulersRepository for listing the schedulers which trigger workflows, and for enabling or disabling a single one.

Examples:

List the schedulers and inspect one:

>>> from cmem_client.client import Client
>>> client = Client.from_env()
>>> for scheduler_id in client.schedulers:
...     print(scheduler_id, client.schedulers[scheduler_id])

Disable a scheduler and enable it again:

>>> client.schedulers.update_enabled("my-project:my-scheduler", enabled=False)
>>> client.schedulers.update_enabled("my-project:my-scheduler", enabled=True)

Classes:

SchedulerUpdateConfig¤

Bases: UpdateConfig

Configuration for updating schedulers.

Attributes:

  • model_config

SchedulersRepository¤

Bases: TaskSearchRepository, UpdateItemProtocol

Repository for managing workflow schedulers.

Provides access to workflow schedulers in Corporate Memory. Schedulers execute workflows at specified intervals and are identified by a ‘project_id:scheduler_id’ composite key.

Functions:

  • fetch_data – Fetch a list from the DI task search endpoint via a type adapter.
  • get_task – Get full task details from the API.
  • items – Get the items of the repository
  • keys – Get the keys of the repository
  • update_enabled – Update the enabled state of a scheduler.
  • update_item – Update an existing item in the repository.
  • values – Get the values of the repository

Attributes:

  • logger (Logger) – Gets the client logger

fetch_data¤

fetch_data()

Fetch a list from the DI task search endpoint via a type adapter.

get_task¤

get_task(project_id, task_id, with_labels=True)

Get full task details from the API.

Parameters:

  • project_id (str) – The project ID.
  • task_id (str) – The task ID.
  • with_labels (bool) – Whether to include labels in the response.

Returns:

  • TaskResponse – The full task details as a TaskResponse model.

items¤

items()

Get the items of the repository

keys¤

keys()

Get the keys of the repository

logger¤

logger: logging.Logger

Gets the client logger

update_enabled¤

update_enabled(scheduler_id, enabled)

Update the enabled state of a scheduler.

Parameters:

  • scheduler_id (str) – Composite scheduler ID in ‘project_id:scheduler_id’ format.
  • enabled (bool) – True to enable, False to disable.

Returns:

  • bool – True if the state was changed, False if already in the desired state.

update_item¤

update_item(item, configuration=None)

Update an existing item in the repository.

Parameters:

  • item (ItemType) – The item to update in the repository.
  • configuration (UpdateItemConfig_contra | None) – Optional configuration for the update operation.

Raises:

values¤

values()

Get the values of the repository

Comments