Node workloads
This article refers to SDK version v0.5.0. The current SDK version is N/A.
Mounted at client.nodes.workloads. A workload is an application instance running on one specific node: a Docker app, a Marketplace app, or a Model. Deploying one means pointing at an application version and, for Marketplace/Model apps, describing which services and ports it exposes (its Compose Config). See the Overview for narrative examples, and Docker apps / Marketplace apps for the equivalent concepts in Panel.
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 moreNodeWorkloadsResource
NodeWorkloadsResource(client: BarbaraClient)
get
get(node_id: str, workload_id: str) -> Workload
delete
delete(node_id: str, workload_id: str) -> None
start
start(node_id: str, workload_id: str) -> None
stop
stop(node_id: str, workload_id: str) -> None
delete_persist
delete_persist(node_id: str, workload_id: str) -> None
refresh_info
refresh_info(node_id: str, workload_id: str) -> None
Ask the node to refresh the workload's reported info/status.
get_container_info
get_container_info(node_id: str, workload_id: str) -> Dict[str, Any]
get_logs
get_logs(
node_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(node_id: str, workload_id: str, enabled: bool) -> None
logs_enabled
logs_enabled(node_id: str, workload_id: str) -> bool
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.
set_app_config
set_app_config(
node_id: str,
workload_id: str,
*,
config: Optional[Dict[str, Any]] = None,
config_id: Optional[str] = None,
) -> None
create_docker_workload
create_docker_workload(
node_id: str,
*,
app_version_id: str,
application_id: str,
run_docker: bool = True,
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(
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,
config: Optional[Dict[str, Any]] = None,
config_id: Optional[str] = None,
) -> None
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.
update_model_workload
update_model_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,
name: Optional[str] = None,
compose_config: Optional[List[Dict[str, Any]]] = None,
) -> None
update_model_workload_compose_config
update_model_workload_compose_config(
node_id: str,
workload_id: str,
compose_config: List[Dict[str, Any]],
) -> None
AsyncNodeWorkloadsResource
AsyncNodeWorkloadsResource(client: AsyncBarbaraClient)
get
get(node_id: str, workload_id: str) -> Workload
delete
delete(node_id: str, workload_id: str) -> None
start
start(node_id: str, workload_id: str) -> None
stop
stop(node_id: str, workload_id: str) -> None
delete_persist
delete_persist(node_id: str, workload_id: str) -> None
refresh_info
refresh_info(node_id: str, workload_id: str) -> None
get_container_info
get_container_info(node_id: str, workload_id: str) -> Dict[str, Any]
get_logs
get_logs(
node_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(node_id: str, workload_id: str, enabled: bool) -> None
logs_enabled
logs_enabled(node_id: str, workload_id: str) -> bool
get_app_config
get_app_config(node_id: str, workload_id: str) -> Dict[str, Any]
set_app_config
set_app_config(
node_id: str,
workload_id: str,
*,
config: Optional[Dict[str, Any]] = None,
config_id: Optional[str] = None,
) -> None
create_docker_workload
create_docker_workload(
node_id: str,
*,
app_version_id: str,
application_id: str,
run_docker: bool = True,
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(
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,
config: Optional[Dict[str, Any]] = None,
config_id: Optional[str] = None,
) -> None
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
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
update_marketplace_workload_compose_config
update_marketplace_workload_compose_config(
node_id: str,
workload_id: str,
compose_config: List[Dict[str, Any]],
) -> None
update_marketplace_workload_app_secrets
update_marketplace_workload_app_secrets(
node_id: str,
workload_id: str,
app_secrets: List[Dict[str, Any]],
) -> None
get_app_secrets
get_app_secrets(node_id: str, workload_id: str) -> List[Dict[str, Any]]
get_compose_config
get_compose_config(node_id: str, workload_id: str) -> List[Dict[str, Any]]
get_urls
get_urls(node_id: str, workload_id: str) -> List[Dict[str, Any]]
get_running_services
get_running_services(node_id: str, workload_id: str) -> List[Dict[str, Any]]
get_status_history
get_status_history(node_id: str, workload_id: str) -> List[Dict[str, Any]]
get_pending_actions
get_pending_actions(node_id: str, workload_id: str) -> Dict[str, bool]
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 — see the sync create_model_workload docstring.
update_model_workload
update_model_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,
name: Optional[str] = None,
compose_config: Optional[List[Dict[str, Any]]] = None,
) -> None
update_model_workload_compose_config
update_model_workload_compose_config(
node_id: str,
workload_id: str,
compose_config: List[Dict[str, Any]],
) -> None
Signatures above are generated from barbara-api-sdk 0.5.0 docstrings. If a new SDK release changes one, this page needs a re-sync — the surrounding prose does not update itself.