Version manager¶
The VersionManager
Class¶
The version manager allows to keep track of changes to the code and to automatically generate a deployment version of the code based on the latest git commit.
- class mlxp.version_manager.VersionManager[source]¶
Bases:
ABC
An abstract class whose children allow custumizing the working directory of the run.
- class mlxp.version_manager.GitVM(parent_work_dir: str, compute_requirements: bool)[source]¶
Bases:
VersionManager
GitVM allows separting development code from code deployed in a cluster and allows to recover exactly the code used for a given run.
GitVM creates a copy of the current directory based on the latest commit, if it doesn’t exist already, then sets the working directory to this copy.
- parent_work_dir: str¶
The target parent directory of the new working directory returned by the version manager
- compute_requirements: bool¶
When set to true, the version manager stores a list of requirements and their version.
- get_info() Dict[str, Any] [source]¶
Return a dictionary containing information about the version used for the run.
The following information is returned: - requirements: the dependencies of the code and their versions. Empty if no requirements file was found. - commit_hash: The hash of the latest commit. - repo_path: Path to the repository.
- Returns:
Dictionary containing information about the version used for the run.
- Return type:
Dict[str, Any]
- make_working_directory() str [source]¶
Create and return a target working directory.
Depending on the user’s choice, the returned directory is either:
The current working directory.
- A directory under self.parent_work_dir/repo_name/latest_commit_hash.
In this case, a copy of the code based on the latest git commit is created and used to run the experiment.
- Return type:
- Returns:
A path to the target working directory