service_wait
Block until a Docker Swarm service reaches the desired task count or completes a rolling update, with timeout and status reporting.
Instructions
Block until a swarm service's tasks converge, or a rolling update finishes.
One contract for both modes: never raises on timeout — the result always carries met and
timed_out. "running" polls task state via the same task-counting logic as
service-tasks://{id_or_name} (not the unconfirmed daemon ServiceStatus field) until running
tasks reach the desired count (Replicated mode) or every returned task is running (Global mode,
which has no fixed target). "update-converged" polls UpdateStatus.State until it reaches a
terminal value (completed or rollback_completed); if the service has never been updated (no
UpdateStatus at all), returns promptly with met=false — there's nothing to converge to, same
as container_wait's no-healthcheck case.
args:
id_or_name - The service id or name
until - Condition to wait for: "running" (default) or "update-converged"
replicas - "running" mode only: override the desired replica count (e.g. right after a
same-turn service_scale call, before polling reflects the new target)
timeout_seconds - Max seconds to wait before returning with timed_out=true (default 600)
poll_interval - Seconds between re-checks (default 2, > 0); capped by the time left so a
large value can't push the total wait past the timeout
returns: dict - {"service", "until", "met", "timed_out", "running_tasks", "desired_tasks",
"failed_tasks", "update_state", "waited_seconds"}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| until | No | running | |
| replicas | No | ||
| id_or_name | Yes | ||
| poll_interval | No | ||
| timeout_seconds | No |