gemseo.disciplines.wrappers.job_schedulers.discipline_wrapper module#
Job schedulers interface.
- class 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:
Discipline
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.
- Parameters:
discipline (Discipline) -- 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.
- Raises:
OSError -- If
job_template_path
does not exist.
- linearize(input_data=None, compute_all_jacobians=False, execute=True)[source]#
Compute the Jacobians of some outputs with respect to some inputs.
- Parameters:
input_data (StrKeyMapping | None) -- The input data. If empty, use the
`default_input_data
.compute_all_jacobians (bool) --
Whether to compute the Jacobians of all the outputs with respect to all the inputs. Otherwise, set the output variables to differentiate with
add_differentiated_outputs()
and the input variables against which to differentiate them withadd_differentiated_inputs()
.By default it is set to False.
execute (bool) --
Whether to start by executing the discipline to ensure that the discipline was executed with the right input data; it can be almost free if the corresponding output data have been stored in the
cache
.By default it is set to True.
- Returns:
The Jacobian matrices in the dictionary form
{output_name: {input_name: jacobian_matrix}}
wherejacobian_matrix[i, j]
is the partial derivative ofoutput_name[i]
wrtinput_name[j]
.- Raises:
ValueError -- When either the inputs for which to differentiate the outputs or the outputs to differentiate are missing.
- Return type:
JacobianData
- TEMPLATES_DIR_PATH: ClassVar[Path] = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/gemseo/envs/stable/lib/python3.9/site-packages/gemseo/disciplines/wrappers/job_schedulers/templates')#