StepSpec#

class rapidtools.jobs.StepSpec(id: str, type: str, inputs: dict[str, ~typing.Any]=<factory>, params: dict[str, ~typing.Any]=<factory>, metadata: dict[str, ~typing.Any]=<factory>)[source]#

Bases: object

One step of a job, exactly as written in the job file.

Variables:
  • id (str) – Name of the step inside its job; later steps and the result file refer to it.

  • type (str) – The step type, e.g. 'detect.aerial'.

  • inputs (dict[str, Any]) – Data the step reads: paths, regions or references to earlier steps.

  • params (dict[str, Any]) – Options of the step type.

  • metadata (dict[str, Any]) – Free-form notes; never interpreted.

Example

>>> step = StepSpec(id='detect', type='detect.aerial',
...                 inputs={'raster': 'scene.tiff'},
...                 params={'assets': ['building']})
>>> step.to_dict()['type']
'detect.aerial'

Methods

from_dict

Build a step from its JSON object.

to_dict

Return the step as a JSON-serializable object.

classmethod from_dict(raw: Any, index: int = 0, version: str = '1.0') → StepSpec[source]#

Build a step from its JSON object.

Parameters:
  • raw (Any) – The decoded step object.

  • index (int) – Zero-based position in steps; a step without an id is named s<index + 1>.

  • version (str) – schema_version of the enclosing job.

Returns:

StepSpec – The step.

Raises:

JobError – If the object is malformed.

to_dict() → dict[str, Any][source]#

Return the step as a JSON-serializable object.