sierra.core.execenv#

Common functionality for --execenv plugins to use.

Classes#

ExpShellCmdsGenerator

Dispatcher for shell cmd generation for an Experiment.

Functions#

check_connectivity(→ None)

Check if passwordless connection to the specified host+login works.

check_for_simulator(→ subprocess.CompletedProcess[bytes])

Check if the specified executable name exists/is findable.

cmdline_postparse_configure(→ argparse.Namespace)

Dispatcher for configuring the cmdopts dictionary.

get_executable_arch_aware(→ str)

Get the executable name in an SIERRA_ARCH-aware way.

parse_nodefile(...)

Parse a text file containing a list of computational resources to use.

Module Contents#

class sierra.core.execenv.ExpShellCmdsGenerator(cmdopts: sierra.core.types.Cmdopts, exp_num: int)[source]#
Inheritance diagram of sierra.core.execenv.ExpShellCmdsGenerator

Dispatcher for shell cmd generation for an Experiment.

Dispatches generation to the selected execution environment. Called during stage 2 to run shell commands immediately before running a given Experiment, to run shell commands to actually run the experiment, and to run shell commands immediately after the experiment finishes.

exec_exp_cmds(exec_opts: sierra.core.types.StrDict) list[sierra.core.types.ShellCmdSpec][source]#

Generate the command to execute an Experiment.

Typically a single GNU parallel invocation, but not required to be. Called during stage 2. Runs in the same sub-shell as the pre- and post-exp commands.

Note

The return value of this method is ignored when defined on an engine plugin. Execution environment plugins are always responsible for the actual parallel dispatch.

Parameters:

exec_opts --

A dictionary containing:

  • jobroot_path - Root directory for the batch experiment.

  • exec_resume - Whether this resumes a previously started experiment.

  • n_jobs - How many parallel jobs are allowed per node.

  • joblog_path - Logfile for the experiment run command (distinct from Project code output).

  • cmdfile_stem_path - Path to the cmdfile, excluding extension.

  • cmdfile_ext - Extension of the cmdfile.

  • nodefile - Path to the file containing compute resources for SIERRA to use. See --nodefile and SIERRA_NODEFILE for details.

post_exp_cmds() list[sierra.core.types.ShellCmdSpec][source]#

Generate cleanup commands for after an Experiment.

Called during stage 1. Commands run after all Experimental Runs in the experiment have finished but before the next experiment starts: stopping background processes, visualization daemons, etc. Runs in the same sub-shell as the pre- and exec-exp commands.

pre_exp_cmds() list[sierra.core.types.ShellCmdSpec][source]#

Generate setup commands for an Experiment.

Called during stage 1. Commands run before any experimental run in the experiment starts, in a new sub-shell: launching daemons, background processes, setting environment variables, etc. that should be common to all runs within the experiment.

sierra.core.execenv.check_connectivity(cmdopts: sierra.core.types.Cmdopts, login: str, hostname: str, port: int, host_type: str) None[source]#

Check if passwordless connection to the specified host+login works.

sierra.core.execenv.check_for_simulator(engine: str, execenv: str, name: str) subprocess.CompletedProcess[bytes][source]#

Check if the specified executable name exists/is findable.

Returns the version string for the executable. Requires the executable respect/accept -v.

sierra.core.execenv.cmdline_postparse_configure(execenv: str, args: argparse.Namespace) argparse.Namespace[source]#

Dispatcher for configuring the cmdopts dictionary.

Dispatches configuring to the selected --execenv. Called before the pipeline starts to add modify existing cmdline arguments after initial parsing.

execenv is needed as an arguments as it is not present in args; it is a "bootstrap" cmdline arg needed to be parsed first to build the parser for the set of cmdline arguments accepted.

sierra.core.execenv.get_executable_arch_aware(base: str) str[source]#

Get the executable name in an SIERRA_ARCH-aware way.

Returns <base>-<arch> if the envvar is set, and <base> otherwise.

sierra.core.execenv.parse_nodefile(nodefile: str) list[sierra.core.types.ParsedNodefileSpec][source]#

Parse a text file containing a list of computational resources to use.

Assumed to be GNU-parallel style.