Experiment Branch Builder¶
orion.core.io.experiment_branch_builder.py
– Module offering an API to solve conflicts¶
Conflicts between two experiments arise when those have different configuration but have the same name. Solving these conflicts require the creation of adapters to bridge from the parent experiment and the child experiment.
-
class
orion.core.io.experiment_branch_builder.
ExperimentBranchBuilder
(conflicts, branching_configuration)[source]¶ Build a new configuration for the experiment based on parent config.
Attributes: conflicting_config
Get configuration of the child experiment
experiment_config
Get configuration of the parent experiment
is_resolved
Return True if all the current conflicts have been resolved
Methods
add_dimension
(self, name[, default_value])Add dimension with given name change_experiment_name
(self, name)Change the child’s experiment name to name create_adapters
(self)Return a list of adapters for every resolution remove_dimension
(self, name[, default_value])Remove dimension with given name rename_dimension
(self, old_name, new_name)Rename dimension old_name to new_name reset
(self, name)Revert a resolution and reset its corresponding conflicts resolve_conflicts
(self[, silence_errors])Automatically resolve conflicts unless manual-resolution is True. set_algo
(self)Set algorithm resolution set_cli_change_type
(self, change_type)Set cli change type set_code_change_type
(self, change_type)Set code change type set_script_config_change_type
(self, change_type)Set script config change type -
add_dimension
(self, name, default_value=None)[source]¶ Add dimension with given name
Only dimensions with conflict type NewDimensionConflict or ChangedDimensionConflict may be added.
Parameters: - name: str
Name of the dimension to add
- default_value: object
Default value for the new dimension. Defaults to
Dimension.NO_DEFAULT_VALUE
. If conflict is ChangedDimensionConflict, default_value is ignored.
Raises: - ValueError
If name is not present in non-resolved conflicts or if default_value is invalid for the corresponding dimension.
-
change_experiment_name
(self, name)[source]¶ Change the child’s experiment name to name
Parameters: - name: str
New name for the child experiment. Must be different from the parent’s name
Raises: - ValueError
If name already exists in database for current user.
- RuntimeError
If there is no code change conflict left to resolve.
-
conflicting_config
¶ Get configuration of the child experiment
-
experiment_config
¶ Get configuration of the parent experiment
-
is_resolved
¶ Return True if all the current conflicts have been resolved
-
remove_dimension
(self, name, default_value=None)[source]¶ Remove dimension with given name
Only dimensions with conflict type MissingDimensionConflict may be added.
Parameters: - name: str
Name of the dimension to add
- default_value: object
Default value for the missing dimension. Defaults to
Dimension.NO_DEFAULT_VALUE
.
Raises: - ValueError
If name is not present in non-resolved conflicts or if default_value is invalid for the corresponding dimension.
-
rename_dimension
(self, old_name, new_name)[source]¶ Rename dimension old_name to new_name
Only dimensions with conflict type MissingDimensionConflict may be renamed, and it can only be renamed to dimensions with conflict type NewDimensionConflict.
Parameters: - old_name: str
Name of the dimension to rename
- new_name: str
Name of the target dimension
Raises: - ValueError
If name is not present in non-resolved conflicts.
Notes
This may create a new conflict if the target dimension has a different prior.
-
reset
(self, name)[source]¶ Revert a resolution and reset its corresponding conflicts
Parameters: - name: str
String representing the resolution as provided in the prompt
Raises: - ValueError
If name does not correspond to one of the current resolutions.
Notes
Side-effect conflicts generated by a reverted resolution will be deleted.
-
resolve_conflicts
(self, silence_errors=True)[source]¶ Automatically resolve conflicts unless manual-resolution is True.
-
set_algo
(self)[source]¶ Set algorithm resolution
Raises: - RuntimeError
If there is no algorithm conflict left to resolve.
-
set_cli_change_type
(self, change_type)[source]¶ Set cli change type
Parameters: - change_type: string
One of the types defined in
orion.core.evc.adapters.CommandLineChange.types
.
Raises: - ValueError
If change_type is not in
orion.core.evc.adapters.CommandLineChange.types
.- RuntimeError
If there is no cli conflict left to resolve.
-
set_code_change_type
(self, change_type)[source]¶ Set code change type
Parameters: - change_type: string
One of the types defined in
orion.core.evc.adapters.CodeChange.types
.
Raises: - ValueError
If change_type is not in
orion.core.evc.adapters.CodeChange.types
.- RuntimeError
If there is no code change conflict left to resolve.
-
set_script_config_change_type
(self, change_type)[source]¶ Set script config change type
Parameters: - change_type: string
One of the types defined in
orion.core.evc.adapters.ScriptConfigChange.types
.
Raises: - ValueError
If change_type is not in
orion.core.evc.adapters.ScriptConfigChange.types
.- RuntimeError
If there is no script config conflict left to resolve.