Environment Resources Module

This module stores environment variables for use in resource detection

class env_resources.EnvResources(nodelist_env_slurm=None, nodelist_env_cobalt=None, nodelist_env_pbs=None, nodelist_env_lsf=None, nodelist_env_lsf_shortform=None)

Stores environment variables to query for system resource information

Class Attributes:

Variables:
  • default_nodelist_env_slurm (string) – Default SLRUM nodelist environment variable

  • default_nodelist_env_cobalt (string) – Default Cobalt nodelist environment variable

  • default_nodelist_env_pbs (string) – Default PBS nodelist environment variable (points to nodefile)

  • default_nodelist_env_lsf (string) – Default LSF nodelist environment variable

  • default_nodelist_env_lsf_shortform (string) – Default LSF short-form nodelist environment variable

Parameters:
  • nodelist_env_slurm (str | None)

  • nodelist_env_cobalt (str | None)

  • nodelist_env_pbs (str | None)

  • nodelist_env_lsf (str | None)

  • nodelist_env_lsf_shortform (str | None)

Object Attributes:

These are set on initialization.

Variables:
  • nodelists (dict) – Environment variable names to query for nodelists by scheduler

  • ndlist_funcs (dict) – Functions to extract nodelists from environment by scheduler

Parameters:
  • nodelist_env_slurm (str | None)

  • nodelist_env_cobalt (str | None)

  • nodelist_env_pbs (str | None)

  • nodelist_env_lsf (str | None)

  • nodelist_env_lsf_shortform (str | None)

__init__(nodelist_env_slurm=None, nodelist_env_cobalt=None, nodelist_env_pbs=None, nodelist_env_lsf=None, nodelist_env_lsf_shortform=None)

Initializes a new EnvResources instance

Determines the environment variables to query for resource information. These are either provided or given defaults.

Parameters:
  • nodelist_env_slurm (String, optional) – The environment variable giving a node list in Slurm format (Default: uses SLURM_NODELIST). Note: This is queried only if a node_list file is not provided.

  • nodelist_env_cobalt (String, optional) – The environment variable giving a node list in Cobalt format (Default: uses COBALT_PARTNAME). Note: This is queried only if a node_list file is not provided and disable_resource_manager=True.

  • nodelist_env_pbs (String, optional) – The environment variable giving a path to a nodefile in PBS format (Default: uses PBS_NODEFILE). This is queried if a node_list file is not provided.

  • nodelist_env_lsf (String, optional) – The environment variable giving a node list in LSF format (Default: uses LSB_HOSTS). Note: This is queried only if a node_list file is not provided.

  • nodelist_env_lsf_shortform (String, optional) – The environment variable giving a node list in LSF short-form format (Default: uses LSB_MCPU_HOSTS). Note: This is queried only if a node_list file is not provided.

Return type:

None

get_nodelist()

Returns nodelist from environment or an empty list

Return type:

List[str | Any]

static abbrev_nodenames(node_list, prefix=None)

Returns nodelist with only string up to first dot

Parameters:
  • node_list (List[str])

  • prefix (str | None)

Return type:

List[str]

static cobalt_abbrev_nodenames(node_list, prefix='nid')

Returns nodelist with prefix and leading zeros stripped

Parameters:
  • node_list (List[str])

  • prefix (str)

Return type:

List[str]

shortnames(node_list)

Returns nodelist with entries in abbreviated form

Parameters:

node_list (List[str])

Return type:

List[str]

static get_slurm_nodelist(node_list_env)

Gets global libEnsemble nodelist from the Slurm environment

Parameters:

node_list_env (str)

Return type:

List[str | Any]

static get_cobalt_nodelist(node_list_env)

Gets global libEnsemble nodelist from the Cobalt environment

Parameters:

node_list_env (str)

Return type:

List[str | Any]

static get_pbs_nodelist(node_list_env)

Gets global libEnsemble nodelist path from PBS environment

Parameters:

node_list_env (str)

Return type:

List[str | Any]

static get_lsf_nodelist(node_list_env)

Gets global libEnsemble nodelist from the LSF environment

Parameters:

node_list_env (str)

Return type:

List[str | Any]

static get_lsf_nodelist_frm_shortform(node_list_env)

Gets global libEnsemble nodelist from the LSF environment from short-form version

Parameters:

node_list_env (str)

Return type:

List[str | Any]