Schema module¶
Reference to the schema.py module.
schema
¶
Schema definitions for Nextpipe.
This module contains schema definitions used for pipeline configurations.
| CLASS | DESCRIPTION |
|---|---|
AppOption |
Option for running an app. |
AppRunConfig |
Configuration for running an app. |
AppOption
dataclass
¶
AppRunConfig
dataclass
¶
AppRunConfig(
input: dict[str, Any] | str | Any,
options: list[AppOption] | dict[str, Any] = list(),
name: str | None = None,
description: str | None = None,
run_configuration: RunConfiguration | None = None,
instance_id: str | None = None,
)
Configuration for running an app.
You can import the AppRunConfig class directly from nextpipe:
This class represents a configuration object used when running an app in a pipeline, containing input data, options, and an optional name.
| PARAMETER | DESCRIPTION |
|---|---|
|
Input data for the app. A JSON app can take a dictionary, multi-file apps can take a directory path as a string. Other types will be passed to the underlying Python SDK as-is (e.g., nextmv.Input).
TYPE:
|
|
Options for running the app, by default empty. These can be provided as a list of
TYPE:
|
|
Name for the run, by default None.
TYPE:
|
|
Description for the run, by default None.
TYPE:
|
|
The configuration to apply when running the app, by default None. If given, it
replaces the
TYPE:
|
|
The ID of the instance to run, by default None. If given, it replaces the
TYPE:
|
Examples:
>>> from nextpipe import AppRunConfig, AppOption
>>> config = AppRunConfig(
... input={"data": [1, 2, 3]},
... options={"threads": 4},
... name="my-run"
... )
The run configuration and instance can be chosen per run, e.g., to pick an execution class based on the size of the scenario at hand.
>>> import nextmv
>>> from nextpipe import AppRunConfig
>>> config = AppRunConfig(
... input={"data": [1, 2, 3]},
... run_configuration=nextmv.RunConfiguration(execution_class="8c16gb12h"),
... instance_id="tuned-for-large",
... )
input
instance-attribute
¶
Input for the app. A JSON app can take a dictionary, multi-file apps can take a directory path as a string. Other types will be passed to the underlying Python SDK as-is (e.g., nextmv.Input).
options
class-attribute
instance-attribute
¶
options: list[AppOption] | dict[str, Any] = field(
default_factory=list
)
Options for running the app.
description
class-attribute
instance-attribute
¶
Description for the run.
run_configuration
class-attribute
instance-attribute
¶
run_configuration: RunConfiguration | None = field(
default=None,
metadata=config(
encoder=_encode_run_configuration,
decoder=_decode_run_configuration,
),
)
The configuration to apply when running the app. Replaces the run_configuration
of the app decorator as a whole, if given.
instance_id
class-attribute
instance-attribute
¶
The ID of the instance to run. Replaces the instance_id of the app decorator,
if given.
get_options
¶
Get options as a dictionary.
This method converts the options attribute to a dictionary if it is provided
as a list of AppOption instances.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary of options. |