This class provided methods that implement the various sub-command operations of the command line interface.
More...
|
| | __init__ (self, ConfigurationManager config_manager) |
| | Initialise an Operations object with the configTool's configuration manager.
|
| |
| | reload_config (self) |
| | Refreshes the configuration managed by the configuration manager and updates the internal cached configuration.
|
| |
| | get_repository (self, str repo) |
| | Return the appropriate repository adapter based on the value of the repo option string.
|
| |
| | run_shell (self, str repo_name) |
| | Setup the repository object and enter a Python shell for interactive mode.
|
| |
| | list_datapoints (self, str repo_name, path, bool recursive) |
| | List all available datapoints and sub-paths found under a given path.
|
| |
| | get_datapoint (self, str repo_name, DataPointPath path, bool get_type, bool get_size, bool use_repr) |
| | Get and print the datapoint value to console.
|
| |
| | set_datapoint (self, str repo_name, DataPointPath path, str value, Optional[Any] requested_type=None) |
| | Set a datapoint's value.
|
| |
| | read_hierarchy (self, DataPointPath path, str output_path, Optional[str] repo_name=None, Optional[RepositoryIf] repo=None) |
| | Reads a datapoint or hierarchy from the repository and stores the data in local files.
|
| |
| | write_hierarchy (self, DataPointPath path, str input_path, Optional[str] repo_name=None, Optional[RepositoryIf] repo=None) |
| | Loads data from local files and writes them into the repository.
|
| |
| | delete_datapoints (self, str repo_name, DataPointPath path, bool recursive) |
| | Deletes a single datapoint or a whole hierarchy if recursive is set to True.
|
| |
| | populate_runtime_repository (self) |
| | Populate the Runtime Configuration Repository.
|
| |
| | validate_persistent_repository (self) |
| | Validate the structure and contents of the Persistent Configuration Repository.
|
| |
|
| | _log_repository_name (self, str repo) |
| | log the repository endpoint.
|
| |
| | _yaml_read_iterator (self, str input_file) |
| | A generator that iterates recursively over a YAML input file, returning (path, type, data) for each datapoint found in the file.
|
| |
| | _repo_iterator (self, RepositoryIf repo, DataPointPath path) |
| | A generator function to iterate recursively over an input repository datapoint path.
|
| |
| | _set_datapoint_force (self, RepositoryIf repo, DataPointPath path, data_type, data) |
| | Helper function used to set a datapoint in the repository.
|
| |
This class provided methods that implement the various sub-command operations of the command line interface.
| cli.operations.Operations._repo_iterator |
( |
| self, |
|
|
RepositoryIf | repo, |
|
|
DataPointPath | path ) |
|
protected |
A generator function to iterate recursively over an input repository datapoint path.
Yields (path, type, data) for each datapoint, where the path is the full path for the datapoint within the repository, type is the type of the datapoint as known by RepositoryIf, and data is the value of the datapoint.
| cli.operations.Operations.read_hierarchy |
( |
| self, |
|
|
DataPointPath | path, |
|
|
str | output_path, |
|
|
Optional[str] | repo_name = None, |
|
|
Optional[RepositoryIf] | repo = None ) |
Reads a datapoint or hierarchy from the repository and stores the data in local files.
The datapoint or hierarchy of datapoints indicated by path are copied from the repository and written to the file or directory indicated by output_path. The output format used depends on the file extension used or if a directory has been given instead. The following output formats are supported:
- FITS - if output_path ends in '.fits'.
- YAML - if output_path ends in '.yaml'.
- Directory layout compatible with PersistentRepoAdapter - if a directory is given.
The repository to access must be identified by either providing 'repo_name' or the adapter object directly with 'repo'.
- Parameters
-
| path | The path of the datapoint or hierarchy to read from. |
| output_path | The path of the output file or directory. |
| repo_name | Name of the repository 'runtime' or 'persistent'. |
| repo | The repository adapter. |
| cli.operations.Operations.write_hierarchy |
( |
| self, |
|
|
DataPointPath | path, |
|
|
str | input_path, |
|
|
Optional[str] | repo_name = None, |
|
|
Optional[RepositoryIf] | repo = None ) |
Loads data from local files and writes them into the repository.
Data is read from the file or directory indicated by input_path and written to the corresponding datapoints into the repository under the given datapoint path hierarchy. The expected format of the input files depends on the file extension of input_path, or if it points to a directory. The following input formats are supported:
- FITS - if input_path ends in '.fits'.
- YAML - if input_path ends in '.yaml'.
- Directory layout compatible with PersistentRepoAdapter - if a directory is given.
The repository to access must be identified by either providing 'repo_name' or the adapter object directly with 'repo'.
- Parameters
-
| path | The path of the datapoint or hierarchy to write to. |
| input_path | The path of the input file or directory. |
| repo_name | Name of the repository 'runtime' or 'persistent'. |
| repo | The repository adapter. |