Skip to main content

Cluster workloads

This article refers to SDK version v0.6.0. The current SDK version is N/A.

Mounted at client.clusters.workloads. The cluster-level equivalent of a node workload: deploys an application across every node in a cluster in one call, rather than iterating node by node. Barbara's product docs use "Workload" at both scopes — there's no separate "stack" concept in Panel. See the Overview for narrative examples, and Add applications for the equivalent Panel actions.

Concept

Workload. What Barbara Panel calls one deployed application instance, shown as its own card with Status, Logs, App Config, and Info segments, whether it's a Docker app, a Marketplace app, or a Model.

Learn more

ClusterWorkloadsResource​

ClusterWorkloadsResource(client: BarbaraClient)

delete​

delete(cluster_id: str, workload_id: str) -> None

get_logs​

get_logs(
cluster_id: str,
workload_id: str,
*,
from_: Optional[str] = None,
to: Optional[str] = None,
results: int = 100,
search: Optional[str] = None,
) -> List[Dict[str, Any]]

enable_logs​

enable_logs(cluster_id: str, workload_id: str, enabled: bool) -> None

set_app_config​

set_app_config(
cluster_id: str,
workload_id: str,
*,
config: Optional[Dict[str, Any]] = None,
config_id: Optional[str] = None,
) -> None

create_docker_workload​

create_docker_workload(
cluster_id: str,
*,
app_version_id: str,
application_id: str,
force_pull: bool = False,
enable_logs: bool = True,
config: Optional[Dict[str, Any]] = None,
config_id: Optional[str] = None,
) -> None

update_docker_workload​

update_docker_workload(
cluster_id: str,
workload_id: str,
*,
app_version_id: str,
application_id: str,
force_pull: bool = False,
enable_logs: bool = True,
config: Optional[Dict[str, Any]] = None,
config_id: Optional[str] = None,
) -> None

create_marketplace_workload​

create_marketplace_workload(
cluster_id: str,
*,
app_version_id: str,
application_id: str,
name: str,
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,
deployment: Optional[List[Dict[str, Any]]] = None,
placement_constraints: Optional[List[Dict[str, Any]]] = None,
) -> None

deployment ({"name", "mode", "replicas"} per service) and placement_constraints ({"name", "constraints"} per service) are cluster-only — see _build_stack_services for the full semantics of each.

update_marketplace_workload​

update_marketplace_workload(
cluster_id: str,
workload_id: str,
*,
app_version_id: str,
application_id: str,
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,
deployment: Optional[List[Dict[str, Any]]] = None,
placement_constraints: Optional[List[Dict[str, Any]]] = None,
) -> None

Cluster-level workloads have no get() to read back their current state — unlike the node-level equivalent, giving only some of compose_config/app_secrets/deployment/ placement_constraints here REPLACES the whole services array and clears whichever axes you didn't pass. Track and pass the full desired state yourself if that matters.

update_marketplace_workload_compose_config​

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

No get() at cluster scope (see update_marketplace_workload) — this REPLACES the entire services array, clearing App Secrets, Deployment & Replicas, and Placement Constraints if not included here.

update_marketplace_workload_app_secrets​

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

No get() at cluster scope (see update_marketplace_workload) — this REPLACES the entire services array, clearing Compose Config, Deployment & Replicas, and Placement Constraints if not included here.

get_urls​

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

Reads back the URLs Panel shows for a deployed Marketplace app. There's no per-workload get() at cluster scope, but client.clusters.get(cluster_id) embeds every stack's full current state under raw["stacks"], including this at stacks[].app.current.marketAppVersionId.uris. See barbara.utils.decode_uris for the shape.

get_running_services​

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

Reads back the live Docker Swarm service state backing this stack — stacks[].clusterInfo.services[], one entry per Swarm service with its own tasks[] (per-node running/shutdown/failed/ orphaned state). Returned as-is (not base64-decoded — this is Docker's own JSON, unlike Compose Config/App Secrets), unlike the node-level get_running_services() which is a lightly-normalized subset of Docker container info.

create_model_workload​

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

Model workloads have Compose Config, Deployment & Replicas, and Placement Constraints, but neither App Config nor App Secrets — see NodeWorkloadsResource.create_model_workload. compose_config must exactly match the service template declared by the selected model application version.

update_model_workload​

update_model_workload(
cluster_id: str,
workload_id: str,
*,
app_version_id: str,
application_id: str,
force_pull: bool = False,
enable_logs: bool = True,
gpu: Optional[bool] = None,
name: Optional[str] = None,
compose_config: Optional[List[Dict[str, Any]]] = None,
deployment: Optional[List[Dict[str, Any]]] = None,
placement_constraints: Optional[List[Dict[str, Any]]] = None,
) -> None

update_model_workload_compose_config​

update_model_workload_compose_config(
cluster_id: str,
workload_id: str,
compose_config: List[Dict[str, Any]],
) -> None

No get() at cluster scope — this REPLACES the entire services array, clearing Deployment & Replicas and Placement Constraints if not included here.

AsyncClusterWorkloadsResource​

AsyncClusterWorkloadsResource(client: AsyncBarbaraClient)

delete​

delete(cluster_id: str, workload_id: str) -> None

get_logs​

get_logs(
cluster_id: str,
workload_id: str,
*,
from_: Optional[str] = None,
to: Optional[str] = None,
results: int = 100,
search: Optional[str] = None,
) -> List[Dict[str, Any]]

enable_logs​

enable_logs(cluster_id: str, workload_id: str, enabled: bool) -> None

set_app_config​

set_app_config(
cluster_id: str,
workload_id: str,
*,
config: Optional[Dict[str, Any]] = None,
config_id: Optional[str] = None,
) -> None

create_docker_workload​

create_docker_workload(
cluster_id: str,
*,
app_version_id: str,
application_id: str,
force_pull: bool = False,
enable_logs: bool = True,
config: Optional[Dict[str, Any]] = None,
config_id: Optional[str] = None,
) -> None

update_docker_workload​

update_docker_workload(
cluster_id: str,
workload_id: str,
*,
app_version_id: str,
application_id: str,
force_pull: bool = False,
enable_logs: bool = True,
config: Optional[Dict[str, Any]] = None,
config_id: Optional[str] = None,
) -> None

create_marketplace_workload​

create_marketplace_workload(
cluster_id: str,
*,
app_version_id: str,
application_id: str,
name: str,
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,
deployment: Optional[List[Dict[str, Any]]] = None,
placement_constraints: Optional[List[Dict[str, Any]]] = None,
) -> None

update_marketplace_workload​

update_marketplace_workload(
cluster_id: str,
workload_id: str,
*,
app_version_id: str,
application_id: str,
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,
deployment: Optional[List[Dict[str, Any]]] = None,
placement_constraints: Optional[List[Dict[str, Any]]] = None,
) -> None

Cluster-level workloads have no get() to read back their current state — unlike the node-level equivalent, giving only some of compose_config/app_secrets/deployment/ placement_constraints here REPLACES the whole services array and clears whichever axes you didn't pass.

update_marketplace_workload_compose_config​

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

No get() at cluster scope (see update_marketplace_workload) — this REPLACES the entire services array, clearing App Secrets, Deployment & Replicas, and Placement Constraints if not included here.

update_marketplace_workload_app_secrets​

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

No get() at cluster scope (see update_marketplace_workload) — this REPLACES the entire services array, clearing Compose Config, Deployment & Replicas, and Placement Constraints if not included here.

get_urls​

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

get_running_services​

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

create_model_workload​

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

update_model_workload​

update_model_workload(
cluster_id: str,
workload_id: str,
*,
app_version_id: str,
application_id: str,
force_pull: bool = False,
enable_logs: bool = True,
gpu: Optional[bool] = None,
name: Optional[str] = None,
compose_config: Optional[List[Dict[str, Any]]] = None,
deployment: Optional[List[Dict[str, Any]]] = None,
placement_constraints: Optional[List[Dict[str, Any]]] = None,
) -> None

update_model_workload_compose_config​

update_model_workload_compose_config(
cluster_id: str,
workload_id: str,
compose_config: List[Dict[str, Any]],
) -> None

No get() at cluster scope — this REPLACES the entire services array, clearing Deployment & Replicas and Placement Constraints if not included here.


Signatures above are generated from barbara-api-sdk 0.6.0 docstrings. If a new SDK release changes one, this page needs a re-sync — the surrounding prose does not update itself.