meanap.pipeline.cancellation

Cooperative cancellation for pipeline runs.

The pipeline is long-running (spike detection + probabilistic thresholding can take minutes). To let the GUI’s Stop button actually interrupt a run, each step periodically calls check_cancel(should_cancel) — typically once per recording — which raises PipelineCancelled when the caller’s should_cancel predicate returns True. This unwinds cleanly back to run_pipeline’s caller, which is expected to treat it as a normal stop rather than an error.

Lives in its own module (importing nothing from the rest of the package) so both runner and the individual stepN modules can import it without creating a circular import.

Functions

check_cancel(should_cancel)

Raise PipelineCancelled if should_cancel reports cancellation.

Exceptions

PipelineCancelled

Raised to unwind the pipeline when the user requests cancellation.

exception meanap.pipeline.cancellation.PipelineCancelled[source]

Bases: Exception

Raised to unwind the pipeline when the user requests cancellation.

meanap.pipeline.cancellation.check_cancel(should_cancel)[source]

Raise PipelineCancelled if should_cancel reports cancellation.

Parameters:

should_cancel (Callable[[], bool] | None)

Return type:

None