rail.projects.execution module

Functions to execute pipeline and other shell commands

class rail.projects.execution.RunMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Choose the run mode

bash = 1
dry_run = 0
slurm = 2
rail.projects.execution.handle_command(run_mode, command_line)[source]

Run a single command in the mode requested

Return type:

int

Parameters:
  • run_mode (RunMode) – How to run the command, e.g., dry_run, bash or slurm

  • command_line (list[str]) – Tokens in the command line

Returns:

Status returned by the command. 0 for success, exit code otherwise

Return type:

int

rail.projects.execution.handle_commands(run_mode, command_lines, script_path=None)[source]

Run a multiple commands in the mode requested

Return type:

int

Parameters:
  • run_mode (RunMode) – How to run the command, e.g., dry_run, bash or slurm

  • command_lines (list[list[str]]) – List of commands to run, each one is the list of tokens in the command line

  • script_path (str | None) – Path to write the slurm submit script to

Returns:

Status returned by the commands. 0 for success, exit code otherwise

Return type:

int

rail.projects.execution.sbatch_wrap(run_mode, site, args)[source]

Wrap a rail_pipe command with site-based arguements

Return type:

int

Parameters:
  • run_mode (RunMode) – How to run the command, e.g., dry_run, bash or slurm

  • site (str) – Execution site, used to set sbatch options

  • args (list[str]) – Additional arguments

Returns:

Status. 0 for success, exit code otherwise

Return type:

int