feat(solver): Phase 3 — server integration and headless solve jobs #289
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Integrate the KCSolve pluggable solver with the Silo worker system so assemblies can be solved server-side via
silorunner. Full specification indocs/src/silo-server/SOLVER.md.Scope
Phase 3a: JSON serialization
Add
to_dict()/from_dict()methods to all KCSolve types in the pybind11 module.SolveContext,SolveResult,Transform,Part,Constraint,MotionDef,SimulationParams,ConstraintDiagnostic"Revolute","Success","Redundant")SolveContext.from_dict(ctx.to_dict()) == ctxFiles:
src/Mod/Assembly/Solver/bindings/kcsolve_py.cppPhase 3b: Server endpoints
Add the
solvermodule to the Silo server with REST API under/api/solver/:/api/solver/jobsPOSTjob_id,status,created_at)/api/solver/jobs/{jobID}GET/api/solver/jobsGETstatus,item,operation,solver)/api/solver/jobs/{jobID}/cancelPOST/api/solver/solversGETThree operation types:
solve,diagnose,kinematic.SSE events on
/api/events:solver.created,solver.claimed,solver.progress,solver.completed,solver.failed.Database migration:
solver_resultstable withUNIQUE(item_id, revision_number, operation).Files (silo repo):
internal/modules/solver/,migrations/020_solver_results.sqlPhase 3c: Runner support
Add solver job execution to
silorunner:kcsolve.runnermodule: reads JSON from stdin, executes solve, writes result JSON to stdoutsolvers,api_version,python_version)solverkcsolvemodule,libKCSolve.so— no FreeCAD installation neededFiles:
src/Mod/Assembly/Solver/bindings/runner.pyPhase 3d: .kc context packing
Pack pre-extracted
SolveContextJSON into.kcarchives on commit:SolveContextand writes tosilo/solver/context.jsonin the archiveFiles:
mods/silo/freecad/silo_origin.pyPhase 3e: Client integration
silo_clientwith solver methods (submit,wait,stream,results)solver.completedFiles:
mods/silo/freecad/,src/Mod/Assembly/Dependencies
References
docs/src/silo-server/SOLVER.md— full server specificationdocs/INTER_SOLVER.md§7 — architecture overviewdocs/src/reference/kcsolve-python.md— Python API reference