State management#
Experiment state#
The state of an experiment is defined by these attributes:
id_experiment: UUID of the experiment.name: Name of the experiment. If not provided, a short 6-alphanum hash ofid_experimentis generated.db: Database handler (discarded on pickling).fields: Accessible at any time, with database storage.runs: Collection ofrunsassociated with the experiment implemented as a dictionary withrunIDs as keys.
Run state#
The state of a run is defined by these attributes:
id_experiment: UUID of the associated experiment.id_run: UUID of the run.config: Fixed parameters of therun, cleared after execution.params: Variable parameters of therun, cleared after execution.vars: Accessible only withinstepsexecution.state: Accessible after execution ofsteps.fields: Accessible at any time, with database storage.exception: Set transparently if thestepraised an exception before raising the exception at experiment-level.steps: Sequence of functions to execute, accessible only withinstepsexecution.
Tip
- For a comprehensive discussion of the semantics of the different attributes, see Model of computation.
- The
stepsattribute can be inspected by astepfunction to read the Python source code of thesteps, which can be used to track the state lineage and/or thestepscode for backup and later analysis.
Example#
We programmatically print the attributes that constitute the strict state of experiments and runs, as well as the respective subsets that are considered for pickling. Declaring the __slots__ attribute allows us to declare explicitly which attributes are allowed, and deny the creation of new ones. This behaviour keeps these objects clean, and enforces the correct use of the available run state attributes. The __state__ attribute is not inherited by Object, it simply defines a list of attributes to be considered by __getstate__ for pickling.
The state attributes of experiments and runs
Output
List of Experiment state attributes:
('id_experiment', 'name', 'fields', 'runs', 'db')
List of Experiment pickled attributes:
('id_experiment', 'name', 'fields', 'runs')
List of Run state attributes:
('id_experiment',
'id_run',
'config',
'params',
'fields',
'state',
'exception',
'vars',
'steps')
List of Run pickled attributes:
('id_experiment',
'id_run',
'config',
'params',
'fields',
'state',
'exception')