feat(solver): Phase 3c — runner solver command handlers #157

Open
opened 2026-02-20 02:02:05 +00:00 by forbes · 0 comments
Owner

Phase 3c: Runner Support

Add solver command handlers to the existing silorunner binary (cmd/silorunner/main.go). The runner already implements the full job lifecycle (claim, start, progress, complete/fail, log, DAG sync). This phase adds solver-run, solver-diagnose, and solver-kinematic to the executeJob switch statement.

See docs/SOLVER.md — Phase 3c

Files to modify

  • cmd/silorunner/main.go — Add solver command dispatch cases to executeJob()

Files to create

  • src/Mod/Assembly/Solver/bindings/runner.pykcsolve.runner Python entry point (invoked by silorunner via subprocess)

Commands

Command Operation Description
solver-run solve Static equilibrium solve
solver-diagnose diagnose Constraint analysis (no placement update)
solver-kinematic kinematic Time-domain kinematic simulation

Execution flow

  1. Runner claims job with solver tag
  2. Extracts SolveContext from job args
  3. Writes context JSON to temp file
  4. Invokes python3 -m kcsolve.runner via subprocess (stdin JSON, stdout result)
  5. Parses result JSON
  6. Reports progress during execution
  7. Completes job with result or fails with error

Standalone process mode

echo "{...}" | python3 -m kcsolve.runner

Reads JSON from stdin, writes result to stdout. Exit 0 = success, non-zero = failure with error on stderr.

Runner config additions

solver:
  kcsolve_path: /opt/create/lib
  python: /opt/create/bin/python3
  max_concurrent: 2

Dependencies

  • Phase 3a (JSON serialization) — kcsolve must support from_dict()/to_dict()
  • Phase 3b (server endpoints) — server must accept and queue solver jobs
  • No FreeCAD installation required on runner
## Phase 3c: Runner Support Add solver command handlers to the existing `silorunner` binary (`cmd/silorunner/main.go`). The runner already implements the full job lifecycle (claim, start, progress, complete/fail, log, DAG sync). This phase adds `solver-run`, `solver-diagnose`, and `solver-kinematic` to the `executeJob` switch statement. See [docs/SOLVER.md — Phase 3c](../docs/SOLVER.md#phase-3c-runner-support) ### Files to modify - `cmd/silorunner/main.go` — Add solver command dispatch cases to `executeJob()` ### Files to create - `src/Mod/Assembly/Solver/bindings/runner.py` — `kcsolve.runner` Python entry point (invoked by silorunner via subprocess) ### Commands | Command | Operation | Description | |---------|-----------|-------------| | `solver-run` | `solve` | Static equilibrium solve | | `solver-diagnose` | `diagnose` | Constraint analysis (no placement update) | | `solver-kinematic` | `kinematic` | Time-domain kinematic simulation | ### Execution flow 1. Runner claims job with `solver` tag 2. Extracts `SolveContext` from job args 3. Writes context JSON to temp file 4. Invokes `python3 -m kcsolve.runner` via subprocess (stdin JSON, stdout result) 5. Parses result JSON 6. Reports progress during execution 7. Completes job with result or fails with error ### Standalone process mode ```bash echo "{...}" | python3 -m kcsolve.runner ``` Reads JSON from stdin, writes result to stdout. Exit 0 = success, non-zero = failure with error on stderr. ### Runner config additions ```yaml solver: kcsolve_path: /opt/create/lib python: /opt/create/bin/python3 max_concurrent: 2 ``` ### Dependencies - Phase 3a (JSON serialization) — kcsolve must support `from_dict()`/`to_dict()` - Phase 3b (server endpoints) — server must accept and queue solver jobs - No FreeCAD installation required on runner
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo#157