SDK: sync and run import the declaring module in a child process

The command line no longer imports a research module, so import-time GPU work
ends with a short-lived child instead of holding a CUDA context for the length
of a followed run. fluksio.sdk.declare starts the child, which writes each
flow's document and shims as JSON; Declared stands in for Flow in sync().
Errors keep their type and message, a child's traceback reaches the user.

Claude-Session: https://claude.ai/code/session_01SSi5AvZ7pFmySK8zy3NPMh
This commit is contained in:
2026-10-28 08:11:14 +01:00
parent 6b8473f207
commit 361ef35d58
8 changed files with 364 additions and 24 deletions
+4 -2
View File
@@ -687,10 +687,12 @@ def test_run_imports_the_module_that_declared_the_flow(tmp_path, monkeypatch):
imported: list[tuple] = []
walked: list[list[str]] = []
monkeypatch.setattr(sdk_cli, "_import", lambda *args: imported.append(args))
monkeypatch.setattr(
sdk_cli, "declare_module", lambda *args: imported.append(args) or []
)
monkeypatch.setattr(
sdk_cli,
"discover",
"declare",
lambda targets, keep_going=False: walked.append(targets) or [],
)