neu_morpho.ops.manifest¶
Manifest status policy shared by the ops.
is_complete(): resume skips successful tasks. blockrun’sManifest.is_donetests key presence, so a recordedfailedwould read as done and never be retried.guarded(): per-task fault isolation, for stage-2 workers only.check_selection(): a resume may not ask stage 1 for bodies it already ran without.check_grid(): nor resume stage 1 on a different block grid.
Stage-2 tasks are one body each and independent, so a bad one costs that body and is recorded. Stage-1 tasks are blocks, and stage 2 aggregates across them: a skipped block would truncate every body passing through it while the output looks complete. So stage 1 fails fast, and resume makes the relaunch cheap.
Attributes¶
Exceptions¶
A resume would reuse completed stage-1 blocks on a different block grid. |
|
A resume asks for bodies that stage 1's completed blocks were not run for. |
|
Stage stopped early by the failure breaker (not a per-task failure). |
|
A manifest records completed work whose output is no longer there. |
Classes¶
Stops a stage when failures stop looking like isolated bad bodies. |
Functions¶
|
Refuse a resume whose block grid or stage-1 settings ( |
|
Refuse to resume a manifest that has outlived the data it describes. |
|
Refuse a resume for bodies the completed stage-1 blocks were not run for. |
|
|
|
|
|
The block grid stage 1 runs on, and any |
|
Per-group status tallies. |
|
Run a stage-2 worker, converting an exception into a |
|
Has this task finished successfully? ( |
|
Would this error recur for every remaining task? |
|
Dump per-task failures as JSONL (tracebacks would bloat the run summary). |
Module Contents¶
- exception neu_morpho.ops.manifest.GridChanged¶
Bases:
RuntimeErrorA resume would reuse completed stage-1 blocks on a different block grid.
Initialize self. See help(type(self)) for accurate signature.
- exception neu_morpho.ops.manifest.SelectionChanged¶
Bases:
RuntimeErrorA resume asks for bodies that stage 1’s completed blocks were not run for.
Initialize self. See help(type(self)) for accurate signature.
- exception neu_morpho.ops.manifest.StageAborted¶
Bases:
RuntimeErrorStage stopped early by the failure breaker (not a per-task failure).
Initialize self. See help(type(self)) for accurate signature.
- exception neu_morpho.ops.manifest.StaleManifest¶
Bases:
RuntimeErrorA manifest records completed work whose output is no longer there.
Initialize self. See help(type(self)) for accurate signature.
- class neu_morpho.ops.manifest.FailureBreaker(max_consecutive: int = 10)¶
Stops a stage when failures stop looking like isolated bad bodies.
Triggers: a systemic exception (
is_systemic()), at once, ormax_consecutivefailures in a row (in completion order); a success resets the streak. It records a reason andcheck()raises, so a batch’s successes are applied first.- check() None¶
Raise
StageAbortedif a trigger fired.
- failure(key: Any, info: dict | None) None¶
- success() None¶
- consecutive = 0¶
- max_consecutive = 10¶
- reason: str | None = None¶
- total = 0¶
- neu_morpho.ops.manifest.check_grid(manifest: Any, group: str, grid: dict, *, stage: str, progress_path: str, record: bool) None¶
Refuse a resume whose block grid or stage-1 settings (
grid_record) differ from those its completed blocks ran with;record(this run processes stage-1 blocks) notes them in the manifest. A manifest from before they were recorded is not checked.
- neu_morpho.ops.manifest.check_manifest_matches_output(manifest: Any, out_dir: str, *, stage: str, progress_path: str, resume: bool) None¶
Refuse to resume a manifest that has outlived the data it describes.
The manifest lives in the work dir and the data possibly in an object store, so clearing the destination would leave a manifest saying every task is done: the run would write nothing and report success. The probe is the stage’s own
info, not the segmentation’s, so meshing into a volume whose labels were never exported is not mistaken for a cleared destination.Only checked when resuming;
resume=Falseis an explicit fresh start.
- neu_morpho.ops.manifest.check_selection(manifest: Any, group: str, allow: set[int] | None, *, stage: str, progress_path: str, record: bool) None¶
Refuse a resume for bodies the completed stage-1 blocks were not run for.
A completed block is never revisited, so a body outside the selection it ran with gets no fragments: stage 2 finds nothing for it and the run reports success. A later run may ask for that selection or a subset of it.
recordis whether this run processes stage-1 blocks: its selection is then recorded in the manifest, since the remaining blocks see only that (Nonefor every label).
- neu_morpho.ops.manifest.grid_changes(before: dict, now: dict) dict¶
{field: (before, now)}over the fields both records have: a record from before a field was recorded is not refused for it.
- neu_morpho.ops.manifest.grid_mismatch(stage: str, where: str, complete: int, changes: dict) str¶
- neu_morpho.ops.manifest.grid_record(block_shape, voxel_size, **settings) dict¶
The block grid stage 1 runs on, and any
settingsits blocks’ output depends on (a mesh’s smoothing and decimation), as recorded and compared.
- neu_morpho.ops.manifest.group_counts(manifest: Any, group: str) dict[str, int]¶
Per-group status tallies.
Manifest.counts()aggregates every group, conflating blocks with bodies.
- neu_morpho.ops.manifest.guarded(worker: Callable[[Any], tuple], key: Any) tuple¶
Run a stage-2 worker, converting an exception into a
failedresult.Workers return
(key, status, metrics, info); on failureinfocarries the traceback and asystemicflag for the breaker.KeyboardInterruptandSystemExitare not caught.
- neu_morpho.ops.manifest.is_complete(manifest: Any, group: str, key: Any) bool¶
Has this task finished successfully? (
failedrecords must be retried.)
- neu_morpho.ops.manifest.is_systemic(exc: BaseException) bool¶
Would this error recur for every remaining task?
MemoryErrorcounts as systemic even though one enormous body can cause it: a process that has hit OOM is not worth trusting for the remaining tasks.
- neu_morpho.ops.manifest.write_failures(path: str, failures: list[dict]) str | None¶
Dump per-task failures as JSONL (tracebacks would bloat the run summary).
- neu_morpho.ops.manifest.FAILED = 'failed'¶