Let a sweep run more than four at a time, and name the run a failure was in

Concurrent runs sat at 4 whatever FLOW_MAX_CASCADES said: that setting bounds
cascades, and the run drivers read a hardcoded MAX_PARALLEL nobody could reach.
FLOW_MAX_RUNS is the knob they read now, --max-runs/--max-cascades/--max-workers
are the same three as flags on serve, and the engine says which numbers it
started with — which is the only way to tell that a settings file was read.

Events keep the run they happened in. The payload always carried it and the
persist path dropped it, so reading one run's failures meant filtering the
engine-wide list; a batch run's id reaches those events now too, since a run
has no journaled item to name itself by.

Also: a provisioner's 0 means "no deadline" rather than "cancel on the next
reconcile", and a command that reaches no engine says how to start one.
This commit is contained in:
2026-08-27 14:17:51 +02:00
parent 2c081fe3ed
commit 081d499edc
23 changed files with 288 additions and 18 deletions
+35
View File
@@ -220,8 +220,22 @@ def _sign_in(admin_id: Any, url: str, data_dir: Path) -> Path:
return write_config(url, token, data_dir)
#: The `serve` flags that are settings under another name, and the setting each
#: one writes. A flag is a real environment variable, which outranks the env
#: file the settings read — so the order is flag, environment, `<data-dir>/env`.
CONCURRENCY_FLAGS = {
"max_workers": "FLOW_MAX_WORKERS",
"max_cascades": "FLOW_MAX_CASCADES",
"max_runs": "FLOW_MAX_RUNS",
}
def cmd_serve(args: argparse.Namespace) -> int:
data_dir = _data_dir(args.data_dir, args.shared)
for flag, name in CONCURRENCY_FLAGS.items():
value = getattr(args, flag, None)
if value is not None:
os.environ[name] = str(value)
_prepare(data_dir)
from sqlmodel import Session
@@ -370,6 +384,27 @@ def _parser() -> argparse.ArgumentParser:
metavar="URL",
help=f"the portal --enroll redeems at (default {DEFAULT_PORTAL})",
)
serve.add_argument(
"--max-runs",
type=int,
default=None,
metavar="N",
help="batch runs driven at once (default 4, FLOW_MAX_RUNS)",
)
serve.add_argument(
"--max-cascades",
type=int,
default=None,
metavar="N",
help="cascades in flight at once (default 4, FLOW_MAX_CASCADES)",
)
serve.add_argument(
"--max-workers",
type=int,
default=None,
metavar="N",
help="python worker processes (default 4, FLOW_MAX_WORKERS)",
)
serve.set_defaults(func=cmd_serve)
enroll = subparsers.add_parser(