parameters
Module for execution parameter support in ML Workbench.
is_externally_set ¶
Check whether a @parameters-decorated instance was populated from the execution parameters file.
This allows code to distinguish "running interactively with declared defaults" from "running as a
triggered job", which is useful e.g. to implement a set_defaults(...) helper that should never
override values coming from a real execution: once a job supplies its execution parameters, all of
them - not just the ones a caller happens to ask about - are treated as authoritative.
Parameters:
-
instance(Any) –A dataclass instance created via the
@parametersdecorator.
Returns:
-
bool–True if the execution parameters file was found for
instance, False otherwise -
bool–(including when
instancewas not created via@parameters).
parameters ¶
Convert a class into a dataclass populated from execution parameters.
When running as a triggered job in ML Workbench, the backend mounts a JSON config
file at PARAMS_FILE_PATH. This decorator reads that file and
overwrites the dataclass defaults with the values from the file.
When running interactively (no config file present), the dataclass defaults are used.
Example: @parameters class MyConfig: alpha: float = 0.1 beta: float = 0.1 dataset: str = "default_dataset" additional: dict = { params : { theta: 0.1 } }