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, config_file=None, no_env_error=None, no_compute_exception=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
Returns a list of available compute packages.
set[str]: names of available compute packages
Clear out current compute settings.
bool: success flag
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.
str): Path to file to write as submission script
Iterable[Mapping]): A list of Dict objects with key-value pairswith which to populate template fields. These will override any values in the currently active compute package.
str: Path to the submission script file
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.4.1, generated by