gemseo / wrappers / job_schedulers

Show inherited members

scheduler_wrapped_disc module

Job schedulers interface.

class gemseo.wrappers.job_schedulers.scheduler_wrapped_disc.JobSchedulerDisciplineWrapper(discipline, workdir_path, scheduler_run_command='sbatch --wait', job_out_filename='batch.srun', job_template_path=None, use_template=True, setup_cmd='', **options)[source]

Bases: MDODiscipline

A discipline that wraps the execution with job schedulers.

The discipline is serialized to the disk, its inputs too, then a job file is created from a template to execute it with the provided options. The submission command is launched, it will set up the environment, deserialize the discipline and its inputs, execute it and serialize the outputs. Finally, the deserialized outputs are returned by the wrapper.

Initialize self. See help(type(self)) for accurate signature.

  • discipline (MDODiscipline) – The discipline to wrap in the job scheduler.

  • workdir_path (Path) – The path to the workdir where the files will be generated.

  • scheduler_run_command (str) –

    The command to call the job scheduler and submit the generated script.

    By default it is set to “sbatch –wait”.

  • job_out_filename (str) –

    The output job file name.

    By default it is set to “batch.srun”.

  • job_template_path (Path | str | None) – The path to the template to be used to make a submission to the job scheduler command.

  • use_template (bool) –

    whether to use template based interface to the job scheduler.

    By default it is set to True.

  • setup_cmd (str) –

    The command used before running the executable.

    By default it is set to “”.

  • **options – The job scheduler specific options to be used in the template.


OSError – If job_template_path does not exist.

DISC_INPUT_FILE_NAME: ClassVar[str] = 'input_data.pckl'
DISC_OUTPUT_FILE_NAME: ClassVar[str] = 'output_data.pckl'
DISC_PICKLE_FILE_NAME: ClassVar[str] = 'discipline.pckl'
TEMPLATES_DIR_PATH: ClassVar[Path] = PosixPath('/home/docs/checkouts/')
cache: AbstractCache | None

The cache containing one or several executions of the discipline according to the cache policy.

data_processor: DataProcessor

A tool to pre- and post-process discipline data.

exec_for_lin: bool

Whether the last execution was due to a linearization.

input_grammar: BaseGrammar

The input grammar.

jac: MutableMapping[str, MutableMapping[str, ndarray | csr_array | JacobianOperator]]

The Jacobians of the outputs wrt inputs.

The structure is {output: {input: matrix}}.

name: str

The name of the discipline.

output_grammar: BaseGrammar

The output grammar.

re_exec_policy: ReExecutionPolicy

The policy to re-execute the same discipline.

residual_variables: dict[str, str]

The output variables mapping to their inputs, to be considered as residuals; they shall be equal to zero.

run_solves_residuals: bool

Whether the run method shall solve the residuals.