Skip to content

Node workloads

Mounted at client.nodes.workloads.

barbara.resources.workloads.NodeWorkloadsResource

NodeWorkloadsResource(client: BarbaraClient)

refresh_info

refresh_info(node_id: str, workload_id: str) -> None

Ask the node to refresh the workload's reported info/status.

get_app_config

get_app_config(
    node_id: str, workload_id: str
) -> Dict[str, Any]

Returns the decoded config dict — symmetric with set_app_config(config=...). See NodesResource.get_global_config for why the raw response isn't returned as-is.

create_marketplace_workload

create_marketplace_workload(
    node_id: str,
    *,
    app_version_id: str,
    application_id: str,
    name: str,
    run_docker: bool = True,
    force_pull: bool = False,
    enable_logs: bool = True,
    gpu: Optional[bool] = None,
    config: Optional[Dict[str, Any]] = None,
    config_id: Optional[str] = None,
    compose_config: Optional[List[Dict[str, Any]]] = None,
    app_secrets: Optional[List[Dict[str, Any]]] = None,
) -> None

compose_config items are {"name", "ports", "volumes"}; app_secrets items are {"name", "env"} — see the module docstring for why these are split even though the wire sends both in the same services field.

update_marketplace_workload

update_marketplace_workload(
    node_id: str,
    workload_id: str,
    *,
    app_version_id: str,
    application_id: str,
    run_docker: bool = True,
    force_pull: bool = False,
    enable_logs: bool = True,
    gpu: Optional[bool] = None,
    config: Optional[Dict[str, Any]] = None,
    config_id: Optional[str] = None,
    name: Optional[str] = None,
    compose_config: Optional[List[Dict[str, Any]]] = None,
    app_secrets: Optional[List[Dict[str, Any]]] = None,
) -> None

If only one of compose_config/app_secrets is given, the other side is read back from the workload's current state first and resent unchanged — seeing only one of the two here does not clear the other, unlike calling client.request(...) directly against the wire would.

update_marketplace_workload_compose_config

update_marketplace_workload_compose_config(
    node_id: str,
    workload_id: str,
    compose_config: List[Dict[str, Any]],
) -> None

Changes only Compose Config (ports/volumes) — reads the workload's current App Secrets first and resends them unchanged, since the wire's PUT replaces the entire services array at once (no partial per-field update). See update_marketplace_workload_app_secrets for the reverse.

update_marketplace_workload_app_secrets

update_marketplace_workload_app_secrets(
    node_id: str,
    workload_id: str,
    app_secrets: List[Dict[str, Any]],
) -> None

Changes only App Secrets (env) — reads the workload's current Compose Config first and resends it unchanged, same reasoning as update_marketplace_workload_compose_config above.

get_app_secrets

get_app_secrets(
    node_id: str, workload_id: str
) -> List[Dict[str, Any]]

Reads back a Marketplace workload's App Secrets (env), decoded — Marketplace-only, Model/Docker workloads have no App Secrets. Returns one entry per service that has any env set, as {"name": str, "env": {...}}, the same shape update_marketplace_workload_app_secrets takes.

get_compose_config

get_compose_config(
    node_id: str, workload_id: str
) -> List[Dict[str, Any]]

Reads back a Marketplace or Model workload's Compose Config (ports/volumes), decoded. Returns one entry per service that has any ports/volumes set, as {"name": str, "ports": {...}, "volumes": {...}}, the same shape update_marketplace_workload_compose_config/ update_model_workload_compose_config take.

get_urls

get_urls(
    node_id: str, workload_id: str
) -> List[Dict[str, Any]]

Reads back the "Urls" section Panel shows for a deployed Marketplace app — see barbara.utils.decode_uris for the shape. Empty for Docker/Model workloads, or a Marketplace app version that doesn't publish any.

get_running_services

get_running_services(
    node_id: str, workload_id: str
) -> List[Dict[str, Any]]

Reads back the running containers backing this workload — the same detail Panel uses to paint a workload's service cards. See _running_services for the exact fields.

get_status_history

get_status_history(
    node_id: str, workload_id: str
) -> List[Dict[str, Any]]

The workload's command-result history (spaceStatus.status) — each entry is a past command received by the node for this workload, with code/msg/timestamp/isError/ inProgress/cleanErrorCode. inProgress: True marks an entry that hasn't finished yet; isError: True marks one that failed. Complements get_pending_actions(), which reports only the current in-flight state per action rather than the full history.

get_pending_actions

get_pending_actions(
    node_id: str, workload_id: str
) -> Dict[str, bool]

Whether a command sent to the node for this workload is still being applied, one boolean per action (update/delete/run/stop_build/persistent). See barbara.utils.decode_pending_actions.

create_model_workload

create_model_workload(
    node_id: str,
    *,
    app_version_id: str,
    application_id: str,
    name: str,
    run_docker: bool = True,
    force_pull: bool = False,
    enable_logs: bool = True,
    gpu: Optional[bool] = None,
    compose_config: Optional[List[Dict[str, Any]]] = None,
) -> None

Model workloads have Compose Config, but neither App Config nor App Secrets (unlike Marketplace/Docker). compose_config must exactly match the service template declared by the selected model application version (app_version_id): every service name and each port/volume entry must exist there, or the request is rejected.

barbara.resources.workloads.AsyncNodeWorkloadsResource

AsyncNodeWorkloadsResource(client: AsyncBarbaraClient)

create_model_workload async

create_model_workload(
    node_id: str,
    *,
    app_version_id: str,
    application_id: str,
    name: str,
    run_docker: bool = True,
    force_pull: bool = False,
    enable_logs: bool = True,
    gpu: Optional[bool] = None,
    compose_config: Optional[List[Dict[str, Any]]] = None,
) -> None

Model workloads have Compose Config, but neither App Config nor App Secrets — see the sync create_model_workload docstring.