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
+10 -4
View File
@@ -161,6 +161,11 @@ With no target, it searches the current directory. Directory searches skip
hidden folders, virtual environments, `__pycache__` and `node_modules`.
File paths are not targets: use `study`, not `study.py`.
The modules are imported in a short-lived child process, so work done at
import time, such as opening a GPU context, ends with it and does not stay
in the command. The child's output and its errors appear as they would from
the command itself.
The generated node bodies import your functions. Keep the project available
to each machine running them; sync does not copy your package to a remote
worker. Uploading source requires a superuser token.
@@ -198,10 +203,11 @@ that shares its name with a flag of `run`, such as `timeout`:
fluksio run train --wait --timeout 600 -- timeout=30 lr=0.05
```
After the first sync, `run` imports the module that declared the flow. If no
declaration is recorded, it searches the working directory and skips paths
covered by `.gitignore`. Import errors in that fallback search produce
warnings. Use `--sync PATH` to choose a target explicitly.
After the first sync, `run` imports the module that declared the flow, in a
child process as `sync` does. If no declaration is recorded, it searches the
working directory and skips paths covered by `.gitignore`. Import errors in
that fallback search produce warnings. Use `--sync PATH` to choose a target
explicitly, or `--no-sync` to skip importing altogether.
| Flag | Purpose |
|---|---|