Judge candidate edits
ratchet_runJudges candidate part edits against YAML acceptance rules, promotes passing candidates as the new baseline, and logs failures with reasons; run in estimate-only mode first.
Instructions
Judge candidate edits of a finished part and keep the ones that pass the rules of the YAML (the ratchet).
The start part is judged first (the baseline). A candidate that passes every listed rule becomes the new parent (folder acc_NN in the ratchet root). A candidate that fails is kept in the log with the reason. The rules are the list acceptance.rules in the problem YAML; a rule that is not listed is off. Nothing in the start run is written.
estimate_only: default True. It returns the rules, what each rule needs, what is missing (a rule with a missing input fails every candidate), the number of candidates and the time of verify (its own estimate), and starts nothing. Tell the user the numbers, then call again with estimate_only=false. A real start returns at once (a detached process does the work, like verify_run); call ratchet_status to watch it. Only one job goes at a time on this machine.
Reply to a start: ok, started, run_dir, root, pid, log_file, check (the estimate), message.
On a wrong input: {"ok": false, "error": ..., "exit_code": 1 or 2}.
run_dir: the finished run (needs run.json, labels.bin for marks, result/final.stl). Default: the last run of this server.
source: marks:FILE (a marks file of the Refine page: one candidate for each mark, made by apply_marks) or stl:FOLDER (each STL file of the folder is a candidate). marks: a marks file, the same as source="marks:FILE".
root: the ratchet folder (default: beside the run folder, <run folder>-ratchet). A second call with the same root goes on where the first stopped. If the rules, the mesh size or the inputs (the YAML, the region files) differ from the ratchet in the root, the call stops with the facts: use a new root; or rebaseline=true (judge the current parent again under the new inputs, keep the log); or overwrite=true (it moves the old files into earlier_NN).
override_lock: run although another process holds the job lock of the root.
stop_before_promote: the owner gate. The job stops before it promotes an accepted candidate (ratchet_status shows pending); ratchet_approve promotes it or drops it. Off by default; the YAML key acceptance.owner_gate does the same.
yaml_path: the problem YAML, if the path in run.json is not valid.
max_candidates: judge at most this many in this call. mesh_size_mm: the size of the baseline and of all candidates.
Each candidate is judged against the current parent with topopt printcheck and, if a rule needs it, topopt verify at the mesh size of the baseline. Every limit comes from the YAML and the log names its source.
A stress or stiffness rule on a marks candidate is judged like on any other candidate. If verify refuses the surface (an apply_marks step that fell back to the plain boolean seam), the log record has errors.verify and the rule check is no_input.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| root | No | ||
| marks | No | ||
| source | No | ||
| run_dir | No | ||
| overwrite | No | ||
| yaml_path | No | ||
| rebaseline | No | ||
| mesh_size_mm | No | ||
| estimate_only | No | ||
| override_lock | No | ||
| max_candidates | No | ||
| stop_before_promote | No |