-
Notifications
You must be signed in to change notification settings - Fork 0
Experiment
class Experiment()def before_main() -> Callable[[Callable[..., None]], Callable[..., None]]Register a hook function to be invoked before the main function. The function will receive the same input as the main function and have the final chance to modify experiment meta data. For example, this function can be utilized to modify experiment name according to command line args.
@property
def birth() -> datetimeThe creation time of the experiment object.
@property
def name() -> strExperiment name.
@property
def meta_file_path() -> PathPath to the meta file, relative to the experiment directory.
@property
def args() -> dict[str, object]Parsed command args.
@property
@cache
def path() -> PathPath to the experiment directory.
def dump_meta(**json_options: Any) -> MetaDump experiment meta to JSON file.
Returns:
-
metaExperiment.Meta - The dumped meta.
def init(meta_json_options: dict[str, Any] | None = None) -> NoneInitialize the experiment directory.
def main(*command_args, **command_kwargs) -> Callable[[Callable], click.Command]Creates the click command and use the decorated function as callback. (Additional command arguments and options can be declared with corresponding click functions.)
Returns:
decorator (Callable[[Callable], click.Command]): The decorator for the callback.
def param(cls: type[click.Parameter], *args, **kwargs) -> propertyCreate a param property that is to be read from the experiment command. (All arguments will be forwarded to the constructor.)
Returns:
-
paramclick.Parameter - The created param.
def argument(*args, **kwargs) -> propertyCreate an argument property that is to be read from the experiment command.
(All arguments will be forwarded to click.Argument().)
Returns:
-
argumentclick.Argument - The created argument.
def option(*args, **kwargs) -> propertyCreate an option property that is to be read from the experiment command.
(All arguments will be forwarded to click.Option().)
Returns:
-
optionclick.Option - The created option.
def context() -> "ExperimentContext"Get an experiment context for the experiment.
def run(*args, **kwargs) -> objectRun experiment command. (All arguments will be passed to the command.)
Returns:
-
return_valueobject - The value returned by the command.
def load(**json_options: Any) -> NoneLoad the experiment from an existing archive.