Experiment Branch Builder¶
Module offering an API to solve conflicts¶
Create a list of adapters from the conflicts between an experiment and its parent.
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, enabled=True, manual_resolution=None, storage=None, **branching_arguments)[source]¶
Build a new configuration for the experiment based on parent config.
- Parameters
- conflicts: Conflicts
Object representing a group of conflicts
- manual_resolution: bool, optional
Starts the prompt to resolve manually the conflicts. Use system’s default if not provided.
- branch_from: str, optional
Name of the experiment to branch from.
- algorithm_change: bool, optional
Whether to automatically solve the algorithm conflict (change of algo config). Defaults to True.
- code_change_type: str, optional
How to resolve code change automatically. Must be one of ‘noeffect’, ‘unsure’ or ‘break’. Defaults to ‘break’.
- cli_change_type: str, optional
How to resolve cli change automatically. Must be one of ‘noeffect’, ‘unsure’ or ‘break’. Defaults to ‘break’.
- config_change_type: str, optional
How to resolve config change automatically. Must be one of ‘noeffect’, ‘unsure’ or ‘break’. Defaults to ‘break’.
- 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
(name[, default_value])Add dimension with given name
change_experiment_name
(name)Change the child's experiment name to name
Return a list of adapters for every resolution
remove_dimension
(name[, default_value])Remove dimension with given name
rename_dimension
(old_name, new_name)Rename dimension old_name to new_name
reset
(name)Revert a resolution and reset its corresponding conflicts
resolve_conflicts
([silence_errors])Automatically resolve conflicts unless manual-resolution is True.
set_algo
()Set algorithm resolution
set_cli_change_type
(change_type)Set cli change type
set_code_change_type
(change_type)Set code change type
Set orion version resolution
set_script_config_change_type
(change_type)Set script config change type
- add_dimension(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(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.
- property conflicting_config¶
Get configuration of the child experiment
- property experiment_config¶
Get configuration of the parent experiment
- property is_resolved¶
Return True if all the current conflicts have been resolved
- remove_dimension(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(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(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(silence_errors=True)[source]¶
Automatically resolve conflicts unless manual-resolution is True.
- set_algo()[source]¶
Set algorithm resolution
- Raises
- RuntimeError
If there is no algorithm conflict left to resolve.
- set_cli_change_type(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(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_orion_version()[source]¶
Set orion version resolution
- Raises
- RuntimeError
If there is no orion version conflict left to resolve.
- set_script_config_change_type(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.