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
+28 -28
View File
@@ -175,8 +175,8 @@ class LoadedNode:
#: Published, and with no body of its own — so what runs is the new-node
#: template, which returns nothing at all.
missing_source: bool = False
#: The device this node names although its type never runs on a worker.
ignored_device: str = ""
#: The worker this node names although its type never runs on one.
ignored_worker: str = ""
@dataclass
@@ -482,7 +482,7 @@ class FlowController:
# Without a pool, python nodes are compiled and run in this process —
# which is what the tests do, and what a bare `Pipeline` has always done.
self.workers = workers
# Workers on other hosts. A node without a device never touches it.
# Workers on other hosts. A node naming no worker never touches it.
self.remote = remote
# This machine's own books. The pool sizes its fair share off them.
self.resources = resources
@@ -1005,7 +1005,7 @@ class FlowController:
def _placed(
self,
wanted: Resources,
device: str | None,
label: str | None,
policy: str,
owner: str,
local: str,
@@ -1034,7 +1034,7 @@ class FlowController:
def call(**kwargs: Any) -> Any:
with placer.claim( # type: ignore[union-attr]
wanted, device=device, policy=policy, node=node_id, run=run_id
wanted, label=label, policy=policy, node=node_id, run=run_id
) as (target, allocation):
env = derive_env(wanted, allocation, local=target.worker is None)
if target.worker is None:
@@ -1100,8 +1100,8 @@ class FlowController:
node_type = NODE_TYPES.get(node_def.type)
if node_type is None:
raise ValueError(f"Unknown node type '{node_def.type}'")
if node_def.device and not node_type.has_source:
entry.ignored_device = node_def.device
if node_def.worker and not node_type.has_source:
entry.ignored_worker = node_def.worker
params = resolve_params(node_def.params)
@@ -1153,7 +1153,7 @@ class FlowController:
else:
# The code never runs here: it is loaded in a worker, and
# the node calls that worker instead of a local function.
# A node bound to a device is loaded on *that* machine —
# A node bound to a worker is loaded on *that* machine —
# one importing torch is correct on the GPU box and a
# missing module here, so checking it here would fail a
# node that is fine.
@@ -1170,17 +1170,17 @@ class FlowController:
entry.error = str(exc)
return entry
remote_only = (
node_def.device
and node_def.device_policy == "require"
node_def.worker
and node_def.worker_policy == "require"
and self.remote is not None
)
if remote_only and self.remote is not None:
problem = self.remote.compile(
node_def.device or "", owner, local, code
node_def.worker or "", owner, local, code
)
elif self._runs_elsewhere(wanted):
# Asks for more than this machine has, so it will run on
# one that has it. Same reason as a device: checking the
# one that has it. Same reason as a worker label: checking the
# import here would fail a node that is fine there.
problem = None
else:
@@ -1199,12 +1199,12 @@ class FlowController:
if wanted is not None and self.placer is not None:
# Says how much of a machine it takes, so which machine
# and how much of it are one decision — including when
# it also names a device, which used to mean the two
# it also names a worker, which used to mean the two
# answers disagreed and nothing was accounted at all.
function = self._placed(
wanted,
node_def.device,
node_def.device_policy,
node_def.worker,
node_def.worker_policy,
owner,
local,
code,
@@ -1213,11 +1213,11 @@ class FlowController:
run_id=run.run_id if run else "",
on_event=emissions.handle,
)
elif node_def.device and self.remote is not None:
# A device and nothing about size: the label alone
elif node_def.worker and self.remote is not None:
# A worker and nothing about size: the label alone
# decides, least busy first, as it always has.
function = self.remote.proxy(
node_def.device,
node_def.worker,
owner,
local,
code,
@@ -1235,7 +1235,7 @@ class FlowController:
run_id=run.run_id if run else "",
on_event=emissions.handle,
)
if node_def.device_policy == "prefer"
if node_def.worker_policy == "prefer"
else None
),
)
@@ -1442,11 +1442,11 @@ class FlowController:
)
def compile_check(
self, flow: str, node_id: str, code: str, device: str | None = None
self, flow: str, node_id: str, code: str, worker: str | None = None
) -> str | None:
"""Does this source load? Returns what to show the author, or None.
Loaded on the machine that will run it: a node bound to a device is
Loaded on the machine that will run it: a node bound to a worker is
checked against that worker's packages, because a missing import here
says nothing about whether it is missing there.
@@ -1454,8 +1454,8 @@ class FlowController:
the published one — so ``keep=False``: compile it to answer the
question, and leave the worker holding what it is serving calls from.
"""
if device and self.remote is not None:
return self.remote.compile(device, flow, node_id, code)
if worker and self.remote is not None:
return self.remote.compile(worker, flow, node_id, code)
if self.workers is not None:
return self.workers.compile(flow, node_id, code, keep=False)
try:
@@ -2082,21 +2082,21 @@ def _collect_issues(
for entry in loaded.values()
if entry.missing_source
]
# Only code travels to a worker, so a device on any other node is a field
# Only code travels to a worker, so a worker on any other node is a field
# nothing reads. Saying so beats a setting that looks like it took.
issues += [
ValidationIssue(
code="ignored_device",
code="ignored_worker",
message=(
f"Node '{entry.id.rpartition('.')[2]}' names device "
f"'{entry.ignored_device}', but only a Function node runs on a "
f"Node '{entry.id.rpartition('.')[2]}' names worker "
f"'{entry.ignored_worker}', but only a Function node runs on a "
"worker. The setting is ignored."
),
flow=entry.flow,
node=entry.id,
)
for entry in loaded.values()
if entry.ignored_device
if entry.ignored_worker
]
return issues