Skip to content

cosmotech.coal.cosmotech_api.runner.metadata

metadata

Runner metadata retrieval functions.

get_runner_metadata(api_client, organization_id, workspace_id, runner_id, include=None, exclude=None)

Get runner metadata from the API.

Args: api_client: The API client to use organization_id: The ID of the organization workspace_id: The ID of the workspace runner_id: The ID of the runner include: Optional list of fields to include exclude: Optional list of fields to exclude

Returns: Dictionary with runner metadata

Source code in cosmotech/coal/cosmotech_api/runner/metadata.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def get_runner_metadata(
    api_client: cosmotech_api.api_client.ApiClient,
    organization_id: str,
    workspace_id: str,
    runner_id: str,
    include: Optional[list[str]] = None,
    exclude: Optional[list[str]] = None,
) -> dict[str, Any]:
    """
    Get runner metadata from the API.

    Args:
        api_client: The API client to use
        organization_id: The ID of the organization
        workspace_id: The ID of the workspace
        runner_id: The ID of the runner
        include: Optional list of fields to include
        exclude: Optional list of fields to exclude

    Returns:
        Dictionary with runner metadata
    """
    runner_api = cosmotech_api.RunnerApi(api_client)
    runner: cosmotech_api.Runner = runner_api.get_runner(organization_id, workspace_id, runner_id)

    return runner.model_dump(by_alias=True, exclude_none=True, include=include, exclude=exclude, mode="json")