RVConfig#
- class RVConfig[source]#
Bases:
object
A store of global user-specific configuration not tied to particular pipelines.
This is used to store user-specific configuration like the root temporary directory, verbosity, and other system-wide configuration handled by Everett (eg. which AWS Batch job queue to use).
Attributes
Methods
__init__
()Return the cache directory.
get_config_dict
(rv_config_schema)Get all Everett configuration.
get_namespace_config
(namespace)Get the key-val pairs associated with a namespace.
get_namespace_option
(namespace, key[, ...])Get the value of an option from a namespace.
Return a new TemporaryDirectory object.
Return the root of all temp dirs.
Returns verbosity level for logging.
Returns verbosity in a form that can be passed to RV CLI cmds.
set_everett_config
([profile, rv_home, ...])Set Everett config.
set_tmp_dir_root
([tmp_dir_root])Set root of all temporary directories.
set_verbosity
([verbosity])Set verbosity level for logging.
- get_cache_dir() TemporaryDirectory [source]#
Return the cache directory.
- Return type:
- get_config_dict(rv_config_schema: dict[str, list[str]]) dict[str, str] [source]#
Get all Everett configuration.
This method is used to serialize an Everett configuration so it can be used on a remote instance.
- get_namespace_config(namespace: str) ConfigManager [source]#
Get the key-val pairs associated with a namespace.
- Parameters:
namespace (str) –
- Return type:
ConfigManager
- get_namespace_option(namespace: str, key: str, default: Any | None = None, as_bool: bool = False) Any | None [source]#
Get the value of an option from a namespace.
- get_tmp_dir() TemporaryDirectory [source]#
Return a new TemporaryDirectory object.
- Return type:
- get_verbosity_cli_opt() str [source]#
Returns verbosity in a form that can be passed to RV CLI cmds.
- Returns:
string like “-vvv…”.
- Return type:
- set_everett_config(profile: str | None = None, rv_home: str | None = None, config_overrides: dict[str, str] | None = None)[source]#
Set Everett config.
This sets up any other configuration using the Everett library. See https://everett.readthedocs.io/
It roughly mimics the behavior of how the AWS CLI is configured, if that is a helpful analogy. Configuration can be specified through configuration files, environment variables, and the config_overrides argument in increasing order of precedence.
Configuration files are in the following format: ``` [namespace_1] key_11=val_11 … key_1n=val_1n
…
[namespace_m] key_m1=val_m1 … key_mn=val_mn ```
Each namespace can be used for the configuration of a different plugin. Each configuration file is a “profile” with the name of the file being the name of the profile. This supports switching between different configuration sets. The corresponding environment variable setting for namespace_i and key_ij is namespace_i_key_ij=val_ij.
- Parameters:
profile (str | None) – name of the RV configuration profile to use. If not set, defaults to value of RV_PROFILE env var, or DEFAULT_PROFILE.
rv_home (str | None) – a local dir with RV configuration files. If not set, attempts to use ~/.rastervision.
config_overrides (dict[str, str] | None) – any configuration to override. Each key is of form namespace_i_key_ij with corresponding value val_ij.
- set_tmp_dir_root(tmp_dir_root: str | None = None)[source]#
Set root of all temporary directories.
To set the value, the following rules are used in decreasing priority:
the
tmp_dir_root
argument if it is notNone
an environment variable (
TMPDIR
,TEMP
, orTMP
)a default temporary directory which is a directory returned by
tempfile.TemporaryDirectory
- Parameters:
tmp_dir_root (str | None) –