A node's worker label is worker, so a device is only a paired one

- NodeDef `device`/`device_policy` become `worker`/`worker_policy`, the
  issue `ignored_device` becomes `ignored_worker`, and the SDK's `@node`
  takes `worker=` and `worker_policy=`
- FlowStore._migrate renames the keys in published and draft documents
  once, bumping their version; a queued run's `needs` reads the old key
- placement passes the label as `label`, client regenerated
- docs: worker placement wording, MCP issuer without DOMAIN, device rows in
  the CLI data directory and the API table, device links in compose comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Melvin Strobl
2026-10-16 16:56:05 +02:00
co-authored by Claude Opus 5.5
parent f8011d2a8a
commit a9d453c9d9
40 changed files with 215 additions and 178 deletions
+16 -16
View File
@@ -193,8 +193,8 @@ class NodeSpec:
settings: dict[str, Any],
title: str,
timeout: float | None,
device: str | None,
device_policy: str,
worker: str | None,
worker_policy: str,
cache: bool = True,
resources: dict[str, Any] | None = None,
) -> None:
@@ -206,8 +206,8 @@ class NodeSpec:
self.settings = settings
self.title = title
self.timeout = timeout
self.device = device
self.device_policy = device_policy
self.worker = worker
self.worker_policy = worker_policy
self.cache = cache
self.resources = resources
@@ -238,8 +238,8 @@ class NodeSpec:
settings={**self.settings, **settings},
title=self.title,
timeout=self.timeout,
device=self.device,
device_policy=self.device_policy,
worker=self.worker,
worker_policy=self.worker_policy,
cache=self.cache,
resources=self.resources,
)
@@ -270,8 +270,8 @@ def node(
settings: dict[str, Any] | None = None,
title: str = "",
timeout: float | None = None,
device: str | None = None,
device_policy: str = "require",
worker: str | None = None,
worker_policy: str = "require",
cache: bool = True,
resources: dict[str, Any] | str | None = None,
) -> Callable[[F], F]:
@@ -282,8 +282,8 @@ def node(
shorthand for a ``float`` port of that name.
Parameters with a default that are not ports become the node's settings, so
the canvas can tune them without editing code. ``device`` picks the worker
the code runs on — ``"gpu"``, say — and ``device_policy="prefer"`` runs it
the canvas can tune them without editing code. ``worker`` picks the worker
the code runs on — ``"gpu"``, say — and ``worker_policy="prefer"`` runs it
locally when no such worker is attached rather than waiting for one.
A batch run skips this node when an earlier one already ran the same source
@@ -312,8 +312,8 @@ def node(
thing as ``{"flavor": "gpu-small"}`` and stands in for cpus, gpus and ram.
Sizes accept ``"2G"``; ``duration_s`` accepts ``"30m"``.
"""
if device_policy not in ("require", "prefer"):
raise SyncError("device_policy is 'require' or 'prefer'")
if worker_policy not in ("require", "prefer"):
raise SyncError("worker_policy is 'require' or 'prefer'")
if isinstance(resources, str):
resources = {"flavor": resources}
if resources is not None:
@@ -341,8 +341,8 @@ def node(
settings=dict(settings or {}),
title=title,
timeout=timeout,
device=device,
device_policy=device_policy,
worker=worker,
worker_policy=worker_policy,
cache=cache,
resources=dict(resources) if resources is not None else None,
)
@@ -547,8 +547,8 @@ def _check(spec: NodeSpec, mode: str) -> dict[str, Any]:
"requires": [port.spec() for port in spec.requires],
"provides": [port.spec() for port in spec.provides],
"timeout": spec.timeout,
"device": spec.device,
"device_policy": spec.device_policy,
"worker": spec.worker,
"worker_policy": spec.worker_policy,
"cache": spec.cache,
"resources": spec.resources,
}