title: API — running methods description: pardesline.runner: run a catalog method as a subprocess with validated parameters, RunResult, output directory.
Runner¶
pardesline.runner
¶
Run one algorithm from the catalog as a subprocess, on this machine.
Each op is an argparse script (python -m pardesline.ops.<module>.<script>
--input ... --output ... [--flag value ...]). Running it in a child process keeps
the exact contract the platform uses and isolates native-library crashes
from the caller.
RunResult
dataclass
¶
RunResult(method: Method, output: Path, input: Path, moving: Path | None, params: dict[str, str], command: list[str], log: str, duration_s: float, sidecar: Path | None = None, extra: dict[str, Any] = dict())
What a run produced.
run
¶
run(module: str, method: str | None = None, input: str | PathLike | None = None, /, output: str | PathLike | None = None, *, moving: str | PathLike | None = None, params: dict[str, Any] | None = None, timeout: float = DEFAULT_TIMEOUT, python: str | None = None, on_log: Callable[[str], None] | None = None, on_progress: Callable[[int], None] | None = None, cwd: str | PathLike | None = None, **kwargs: Any) -> RunResult
Run one algorithm on a local file and return a :class:RunResult.
run("point_cloud_processing", "voxel_downsample", "scan.ply", voxel_size=0.05)
or run("point_cloud_processing.voxel_downsample", "scan.ply", ...).
Parameters go as keyword arguments (or in params); they are validated
against the catalog before anything runs. The first three arguments are
positional-only, so a parameter that happens to be called method or
input can still be passed by keyword. Two-input methods (registration)
take the moving file through moving. The result is written to
output or to :func:output_dir. Raises :class:ParameterError or
:class:RunError.
build_command
¶
build_command(method: Method, input_path: Path, output_path: Path, params: dict[str, str], moving_path: Path | None = None, python: str | None = None) -> list[str]
The command line that runs a method's script.
Interpreter, python -m module, --input, --output, --moving and the
validated parameters.
Exposed so callers can log or dry-run the exact invocation.
output_dir
¶
output_dir() -> Path
Where runs write their result when no output is given.
Defaults to <system temp>/pardesline-outputs; change it with
:func:set_output_dir.
set_output_dir
¶
set_output_dir(path: str | PathLike) -> Path
Set where algorithm outputs go when no output= is given; returns the resolved path.