Represents computing configuration objects.
The ComputingConfiguration class provides a computing configuration object
that is an in memory representation of a
divvy computing configuration
file. This object has various functions to allow a user to activate, modify,
and retrieve computing configuration files, and use these values to populate
job submission script templates.
str | Iterable[(str, object)] | Mapping[str, object]): configCollection of key-value pairs.
str): YAML file specifying computing package data. (the
def __init__(self, entries=None, filepath=None)
Iterable[(str, object)] | Mapping[str, object]): YAML collection of key-value pairs.
str): YAML filepath to the config file.
str): YAML-formatted string
bool): whether to create the object with write capabilities
int): how long to wait for creating an object when the file that data will be read from is locked
def activate_package(self, package_name)
Activates a compute package.
This copies the computing attributes from the configuration file into
compute attribute, where the class stores current compute
str): name for non-resource compute bundle,the name of a subsection in an environment configuration file
bool: success flag for attempt to establish compute settings
def clean_start(self, package_name)
Clear current active settings and then activate the given package.
str): name of the resource package to activate
bool: success flag
Environment variable through which to access compute settings.
list[str]: names of candidate environment variables, for whichvalue may be path to compute settings file; first found is used.
Path to default compute environment settings file.
str: Path to default compute settings file
Return the path to the config file or None if not set
str | None: path to the file the object will would to
Returns settings for the currently active compute package
yacman.YacAttMap: data defining the active compute package
Get current adapters, if defined.
Adapters are sourced from the 'adapters' section in the root of the divvy configuration file and updated with an active compute package-specific set of adapters, if any defined in 'adapters' section under currently active compute package.
yacman.YacAttMap: current adapters mapping
Returns a list of available compute packages.
set[str]: names of available compute packages
Clear out current compute settings.
bool: success flag
def submit(self, output_path, extra_vars=None)
Get the currently active submission template.
str: submission script content template for current state
Path to folder with default submission templates.
str: path to folder with default submission templates
def update_packages(self, config_file)
Parse data from divvy configuration file.
Given a divvy configuration file, this function will update (not overwrite) existing compute packages with existing values. It does not affect any currently active settings.
str): path to file with new divvy configuration data
Return writability flag or None if not set
bool | None: whether the object is writable now
def write(self, filename=None)
Write the contents to a file.
Make sure that the object has been created with write capabilities
str): a file path to write to
str: the path to the created files
OSError: when the object has been created in a read only mode or other process has locked the file
TypeError: when the filepath cannot be determined.This takes place only if YacAttMap initialized with a Mapping as an input, not read from file.
OSError: when the write is called on an object with no write capabilitiesor when writing to a file that is locked by a different object
def write_script(self, output_path, extra_vars=None)
Given currently active settings, populate the active template to write a submission script. Additionally use the current adapters to adjust the select of the provided variables
str): Path to file to write as submission script
Iterable[Mapping]): A list of Dict objects withkey-value pairs with which to populate template fields. These will override any values in the currently active compute package.
str: Path to the submission script file
Selects the divvy config file path to load.
This uses a priority ordering to first choose a config file path if it's given, but if not, then look in a priority list of environment variables and choose the first available file path to return. If none of these options succeed, the default config path will be returned.
str | NoneType): direct file path specification
str: path to the config file to read
def write_submit_script(fp, content, data)
Write a submission script by populating a template with data.
str): Path to the file to which to create/write submissions script.
str): Template for submission script, defining keys thatwill be filled by given data
Mapping): a "pool" from which values are available to replacekeys in the template
str: Path to the submission script
divvy v0.5.0, generated by