bout_runners.executor.executor

Contains the executor class.

Classes

Executor(bout_paths, submitter, run_parameters)

Executes the command for submitting a run.

class bout_runners.executor.executor.Executor(bout_paths: Optional[bout_runners.executor.bout_paths.BoutPaths] = None, submitter: Optional[bout_runners.submitter.local_submitter.LocalSubmitter] = None, run_parameters: Optional[bout_runners.parameters.run_parameters.RunParameters] = None)[source]

Executes the command for submitting a run.

Examples

The easiest way to use the Executor is to run a script from the root directory of the project (i.e. where the Makefile and data directory are normally situated. The script can simply call

>>> Executor().execute()

and Executor takes care of the rest.

A more elaborate example where all the dependency objects are built manually:

Import the dependencies

>>> from pathlib import Path
>>> from bout_runners.executor.bout_paths import BoutPaths
>>> from bout_runners.submitter.local_submitter import LocalSubmitter

Create the bout_paths object

>>> project_path = Path().joinpath('path', 'to', 'project')
>>> bout_inp_src_dir = Path().joinpath('path', 'to', 'source', 'BOUT.inp')
>>> bout_inp_dst_dir = Path().joinpath('path', 'to', 'destination', 'BOUT.inp')
>>> bout_paths = BoutPaths(project_path=project_path,
...                        bout_inp_src_dir=bout_inp_src_dir,
...                        bout_inp_dst_dir=bout_inp_dst_dir)

Create the executor object

>>> run_parameters = RunParameters({'global': {'nout': 0}})
>>> executor = Executor(
...     bout_paths=bout_paths,
...     submitter=LocalSubmitter(bout_paths.project_path),
...     run_parameters=run_parameters)

Execute the run

>>> executor.execute()
Attributes
__bout_pathsBoutPaths

Getter variable for project_path

__run_parametersRunParameters

Object containing the run parameters

__makeMake

Object for making the project

__commandstr

The terminal command for executing the run

submitterAbstractSubmitter

Object containing the submitter

bout_pathsBoutPaths

Set the properties of self.bout_paths.

Methods

get_execute_command()

Return the execute command string

execute()

Execute a BOUT++ run

Set the input parameters.

Parameters
bout_pathsBoutPaths or None

Object containing the paths If None, default BoutPaths values will be used

submitterAbstractSubmitter

Object containing the submitter

run_parametersRunParameters or None

Object containing the run parameters If None, default parameters will be used

Attributes
bout_paths

Set the properties of self.bout_paths.

run_parameters

Set the properties of self.run_parameters.

Methods

execute(self)

Execute a BOUT++ run.

get_execute_command(self)

Return the execute command string.

property bout_paths

Set the properties of self.bout_paths.

Returns
self.__bout_pathsBoutPaths

Object containing the paths

Notes

The bout_paths is read only

execute(self) → None[source]

Execute a BOUT++ run.

get_execute_command(self) → str[source]

Return the execute command string.

Returns
commandstr

The terminal command for executing the run

property run_parameters

Set the properties of self.run_parameters.

Returns
self.__run_parametersRunParameters

Object containing the run parameters

Notes

The run_parameters is read only