Package divvy Documentation

Class ComputingConfiguration

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.

Parameters:

  • entries (str | Iterable[(str, object)] | Mapping[str, object]): configCollection of key-value pairs.
  • filepath (str): YAML file specifying computing package data. (theDIVCFG file)
def __init__(self, entries=None, filepath=None)

Object constructor

Parameters:

  • entries (Iterable[(str, object)] | Mapping[str, object]): YAML collection of key-value pairs.
  • filepath (str): YAML filepath to the config file.
  • yamldata (str): YAML-formatted string
  • writable (bool): whether to create the object with write capabilities
  • wait_max (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 the compute attribute, where the class stores current compute settings.

Parameters:

  • package_name (str): name for non-resource compute bundle,the name of a subsection in an environment configuration file

Returns:

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

Parameters:

  • package_name (str): name of the resource package to activate

Returns:

  • bool: success flag
def compute_env_var(self)

Environment variable through which to access compute settings.

Returns:

  • list[str]: names of candidate environment variables, for whichvalue may be path to compute settings file; first found is used.
def default_config_file(self)

Path to default compute environment settings file.

Returns:

  • str: Path to default compute settings file
def file_path(self)

Return the path to the config file or None if not set

Returns:

  • str | None: path to the file the object will would to
def get_active_package(self)

Returns settings for the currently active compute package

Returns:

  • yacman.YacAttMap: data defining the active compute package
def get_adapters(self)

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.

Returns:

  • yacman.YacAttMap: current adapters mapping
def list_compute_packages(self)

Returns a list of available compute packages.

Returns:

  • set[str]: names of available compute packages
def reset_active_settings(self)

Clear out current compute settings.

Returns:

  • bool: success flag
def submit(self, output_path, extra_vars=None)
def template(self)

Get the currently active submission template.

Returns:

  • str: submission script content template for current state
def templates_folder(self)

Path to folder with default submission templates.

Returns:

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

Parameters:

  • config_file (str): path to file with new divvy configuration data
def writable(self)

Return writability flag or None if not set

Returns:

  • 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

Parameters:

  • filepath (str): a file path to write to

Returns:

  • str: the path to the created files

Raises:

  • 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

Parameters:

  • output_path (str): Path to file to write as submission script
  • extra_vars (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.

Returns:

  • str: Path to the submission script file
def select_divvy_config(filepath)

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.

Parameters:

  • filepath (str | NoneType): direct file path specification

Returns:

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

Parameters:

  • fp (str): Path to the file to which to create/write submissions script.
  • content (str): Template for submission script, defining keys thatwill be filled by given data
  • data (Mapping): a "pool" from which values are available to replacekeys in the template

Returns:

  • str: Path to the submission script

Version Information: divvy v0.5.0, generated by lucidoc v0.4.2