BpsConfig¶
- class lsst.ctrl.bps.BpsConfig(other, search_order=None, defaults=None, wms_service_class_fqn=None)¶
Bases:
Config
Contains the configuration for a BPS submission.
- Parameters:
- other
str
,dict
,Config
,BpsConfig
Path to a YAML file or a dict/Config/BpsConfig containing configuration to copy.
- search_order
list
[str
], optional Root section names in the order in which they should be searched.
- defaults
str
,dict
,Config
, optional Default settings that will be used to prepopulate the config. If the WMS service default settings are available, they will be added afterwards. WMS settings takes precedence over provided defaults.
- wms_service_class_fqn
str
, optional Fully qualified name of the WMS service class to use to get plugin’s specific default settings. If
None
(default), the WMS service class provided byother
config,environmental variable
BPS_WMS_SERVICE_CLASS
,default settings
will be used instead. The list above also reflects the priorities if the WMS service class is defined in multiple places. For example, the name of service class found in
other
takes precedence over the name of the service class provided by the BPS_SERVICE_CLASS and/or the default settings.
- other
- Raises:
- ValueError
Raised if the class cannot be instantiated from the provided object.
Methods Summary
copy
()Make a copy of config.
get
(key[, default])Return the value for key if key is in the config, else default.
search
(key[, opt])Search for key using given opt following hierarchy rules.
Methods Documentation
- copy()¶
Make a copy of config.
- Returns:
- copy
lsst.ctrl.bps.BpsConfig
A duplicate of itself.
- copy
- get(key, default='')¶
Return the value for key if key is in the config, else default.
If default is not given, it defaults to an empty string.
- Parameters:
- key
str
Key to look for in config.
- defaultAny, optional
Default value to return if the key is not in the config.
- key
- Returns:
- valAny
Value from config if found, default otherwise.
Notes
The provided default value (an empty string) was chosen to maintain the internal consistency with other methods of the class.
- search(key, opt=None)¶
Search for key using given opt following hierarchy rules.
Search hierarchy rules: current values, a given search object, and search order of config sections.
- Parameters:
- key
str
Key to look for in config.
- opt
dict
[str
,Any
], optional Options dictionary to use while searching. All are optional.
"curvals"
Means to pass in values for search order key (curr_<sectname>) or variable replacements. (
dict
, optional)"default"
Value to return if not found. (
Any
, optional)"replaceEnvVars"
If search result is string, whether to replace environment variables inside it with special placeholder (<ENV:name>). By default set to False. (
bool
)"expandEnvVars"
If search result is string, whether to replace environment variables inside it with current environment value. By default set to False. (
bool
)"replaceVars"
If search result is string, whether to replace variables inside it. By default set to True. (
bool
)"required"
If replacing variables, whether to raise exception if variable is undefined. By default set to False. (
bool
)
- key
- Returns:
- found
bool
Whether name was in config or not.
- value
str
,int
,lsst.ctrl.bps.BpsConfig
, … Value from config if found.
- found