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).

DEFAULT_PROFILE#

the default RV configuration profile name

Type

str

DEFAULT_TMP_DIR_ROOT#

the default location for root of temporary directories

Type

str

Attributes

__init__()[source]#

Methods

__init__()

get_cache_dir()

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.

get_tmp_dir()

Return a new TemporaryDirectory object.

get_tmp_dir_root()

Return the root of all temp dirs.

get_verbosity()

Returns verbosity level for logging.

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.

__init__()[source]#
get_cache_dir() TemporaryDirectory[source]#

Return the cache directory.

Return type

TemporaryDirectory

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.

Parameters

rv_config_schema (Dict[str, List[str]]) – each key is a namespace; each value is list of keys within that namespace

Returns

Each key is of form namespace_i_key_ij with corresponding value val_ij.

Return type

Dict[str, str]

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: Optional[Any] = None, as_bool: bool = False) Optional[Any][source]#

Get the value of an option from a namespace.

Parameters
Return type

Optional[Any]

get_tmp_dir() TemporaryDirectory[source]#

Return a new TemporaryDirectory object.

Return type

TemporaryDirectory

get_tmp_dir_root() str[source]#

Return the root of all temp dirs.

Return type

str

get_verbosity() Verbosity[source]#

Returns verbosity level for logging.

Return type

Verbosity

set_everett_config(profile: str = None, rv_home: str = None, config_overrides: Dict[str, str] = 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) – 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) – a local dir with RV configuration files. If not set, attempts to use ~/.rastervision.

  • config_overrides (Dict[str, str]) – 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: Optional[str] = None)[source]#

Set root of all temporary directories.

To set the value, the following rules are used in decreasing priority:

  1. the tmp_dir_root argument if it is not None

  2. an environment variable (TMPDIR, TEMP, or TMP)

  3. a default temporary directory which is a directory returned by tempfile.TemporaryDirectory

Parameters

tmp_dir_root (Optional[str]) –

set_verbosity(verbosity: Verbosity = 1)[source]#

Set verbosity level for logging.

Parameters

verbosity (Verbosity) –

DEFAULT_PROFILE: str = 'default'#
DEFAULT_TMP_DIR_ROOT: str = '/opt/data/tmp'#