phenotypic.sdk_.slurm.SlurmArrayScriptSpec#

class phenotypic.sdk_.slurm.SlurmArrayScriptSpec(job_name: str, slurm_args: ~collections.abc.Mapping[str, ~typing.Any], log_path: ~pathlib.Path, task_indices: ~collections.abc.Sequence[int | str], body: str, error_log_path: ~pathlib.Path | None = None, prelude: str = '', comments: ~collections.abc.Sequence[str] = <factory>, array_name: str = 'TASK_INDICES', current_var: str = 'CURRENT_TASK_INDEX', missing_task_id_message: str = 'ERROR: SLURM_ARRAY_TASK_ID not set', bounds_error_message: str | None = None, signal_grace: int | None = None, requeue: bool = False)[source]#

Bases: object

Specification for a bash SLURM array script.

Parameters:
  • job_name (str) – SLURM job name for #SBATCH --job-name.

  • slurm_args (Mapping[str, Any]) – CLI-style SLURM arguments passed to the shared directive formatter.

  • log_path (Path) – Path used for both stdout and stderr logs.

  • error_log_path (Path | None) – Optional stderr path. Defaults to log_path.

  • task_indices (Sequence[int | str]) – Values mapped from SLURM_ARRAY_TASK_ID into the current task variable. Strings are shell-quoted.

  • body (str) – Bash body executed once the current task variable is available.

  • prelude (str) – Optional bash block inserted after strict mode and before the task array.

  • comments (Sequence[str]) – Optional comment lines inserted after SBATCH directives.

  • array_name (str) – Bash array variable name.

  • current_var (str) – Bash variable that receives the current array entry.

  • missing_task_id_message (str) – Error printed when not running as an array job.

  • bounds_error_message (str | None) – Error printed when the array task id is out of bounds. When omitted, a message is derived from array_name.

  • signal_grace (int | None) – Optional seconds for #SBATCH --signal=B:TERM@N.

  • requeue (bool) – Whether to include #SBATCH --requeue.

Methods

__init__

render

Render the script content.

Attributes

job_name: str#
slurm_args: Mapping[str, Any]#
log_path: Path#
task_indices: Sequence[int | str]#
body: str#
error_log_path: Path | None = None#
prelude: str = ''#
comments: Sequence[str]#
array_name: str = 'TASK_INDICES'#
current_var: str = 'CURRENT_TASK_INDEX'#
missing_task_id_message: str = 'ERROR: SLURM_ARRAY_TASK_ID not set'#
bounds_error_message: str | None = None#
signal_grace: int | None = None#
requeue: bool = False#
render() str[source]#

Render the script content.

Return type:

str