StepType#
- class rapidtools.jobs.StepType(name: str, title: str, doc: str, build: Callable[[...], Any], run: Callable[[StepContext], None], inputs: tuple[Input, ...] = (), params: tuple[Param, ...] = (), outputs: tuple[Output, ...] = (), activity: str = '', empty_hint: str = '', since: str = '1.0')[source]#
Bases:
objectA kind of step a job may contain.
- Variables:
name (str) – The
typewritten in job files,<stage>.<variant>.title (str) – Short human-readable title.
doc (str) – What the step does, for the reference documentation.
build (Callable) –
build(step_type, params, inputs, output_dir, dry)returns the settings object the step runs with, raisingValueErrorfor an invalid combination.dryisTruewhile a job is only being validated, when references to earlier steps are placeholders and no file may be read.run (Callable[[StepContext], None]) – Does the work.
outputs (tuple[Output, ...]) – Files later steps may reference.
activity (str) – The work as a noun (
'inference'), used in messages such as “skipping inference”.empty_hint (str) – What to report when the step finds nothing and a later step needed its result.
since (str) – Interface version that introduced the step type.
Example
>>> detect = get_step_type('detect.aerial') >>> detect.title, [p.name for p in detect.params][:2] ('Detect assets in aerial imagery', ['assets', 'asset_size_m'])
Methods
Validate the
paramsof a step and fill in the defaults.Return
paramskeyed by the settings field each one fills.- read_params(given: dict[str, Any], secrets: Secrets | None = None, allow_missing_secrets: bool = False) dict[str, Any][source]#
Validate the
paramsof a step and fill in the defaults.- Parameters:
- Returns:
dict[str, Any] – A value for every parameter of the step type.
- Raises:
ValueError – For an unknown, missing or invalid parameter.