genvid.toolbox.ProjectTool
Warning
This module has been deprecated. Although the code is still working for our oldest model, it is not expected to work with the new Bastion API.
- class genvid.toolbox.ProjectTool(*args, **kwargs)
Bases:
ConsulTemplateTool
Tool for managing project files.
Changed in version 1.30.0:
LOGS
have been moved toClusterTool
and it’s now considered deprecated.Deprecated since version 1.33.0: Deprecated class. Use
ConfigurationLoader
instead.- load_config_folder(source: Union[Path, str], *, env: Optional[Mapping[str, str]] = None, job_template_dir: Optional[Union[Path, str]] = None, with_consul_template: bool = False) dict
Loads the configuration file(s) (all files in a directory or a specific file) from the source and returns it.
Deprecated since version 1.33.0: See
ConfigurationLoader.load_config_folder()
for more information.
- load_nomad_job_template(name, job_folder: Union[Path, str])
Read nomad job templates from the specific directory. Files only with extension of .nomad.tmpl are read.
Deprecated since version 1.33.0: See
ConfigurationLoader.load_nomad_job_template()
for more information.
- update_config(config: dict, isLocal: bool)
Update the specified configuration.
Deprecated since version 1.33.0: See
ConfigurationLoader.update_config()
for more information.
- update_project(project, _islocal=None) Tuple[dict, bool]
This method tries to update a project to the newer Genvid version.
Deprecated since version 1.33.0: Slightly equivalent to
ConfigurationLoader.update_config()
- get_project_file(dir_or_file)
Return a project file.
The argument can be either a directory or a project file. If it is a directory, the following files will be searched in this order inside the directory:
genvid.hcl
,genvid.json
.
- load_project(dir_or_file: str, **kwargs)
Load a project file.
A project file is either a JSON or HCL file (called either
genvid.json
orgenvid.hcl
) which may or may not contain templating directives to be resolved usingconsul-template
.This method sets
PROJECTDIR
to the directory containing the project file as a side effect.- Parameters:
dir_or_file – The specified path is going to be recursively searched to locate a
genvid.json
orgenvid.hcl
project file.kwargs – All additional keyword parameters are going to be passed directly to
consul-template
.
Note
The Consul server doesn’t need to run if your file doesn’t require anything from Consul. The result is parsed as either a JSON file if the extension is .json or an HCL file, otherwise.
Changed in version 1.21.0:
Adjusted to use the new version of
ConsulTemplateTool
.
- class project.ProjectTool
Implementation of
genvid.toolbox.ProjectTool