Cluster workloads¶
Mounted at client.clusters.workloads.
barbara.resources.workloads.ClusterWorkloadsResource ¶
ClusterWorkloadsResource(client: BarbaraClient)
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_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.
barbara.resources.workloads.AsyncClusterWorkloadsResource ¶
AsyncClusterWorkloadsResource(client: AsyncBarbaraClient)
update_marketplace_workload
async
¶
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
async
¶
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
async
¶
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.
update_model_workload_compose_config
async
¶
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.