|
carputils
Doxygen code documentation for the python framework controlling openCARP
|
A sequence of commands plus the tools to execute them. More...
Public Member Functions | |
| def | __init__ (self, ID) |
| def | register (self, command, delayed=False) |
| Register a command to be executed. More... | |
| def | script (self) |
| Generate a bash script running the command sequence. More... | |
| def | submit (self, argv=None) |
| Submit the command sequence to the batch system. More... | |
| def | bash (self, cmd, message=None, delayed=False, *args, **kwargs) |
| Execute an arbitrary command in the shell. More... | |
| def | mpi (self, cmd, message='Executing MPI Command', *args, **kwargs) |
| Execute a command with MPI. More... | |
| def | bench (self, cmd, simname=None, msg=None, *args, **kwargs) |
| Execute a BENCH simulation. More... | |
| def | carp (self, cmd, simname=None, polling_subdirs=True, *args, **kwargs) |
| Execute an openCARP simulation. More... | |
| def | python (self, cmd, *args, **kwargs) |
| Execute a python script. More... | |
| def | meshtool (self, cmd, *args, stdout=None, stderr=None, **kwargs) |
| Execute meshtool. More... | |
| def | cvstool (self, cmd, stdout=None, stderr=None, *args, **kwargs) |
| Execute cvstool. More... | |
| def | mkdir (self, directory, parents=False, *args, **kwargs) |
| Make a directory. More... | |
| def | cp (self, path_from, path_to, cpdir=False, *args, **kwargs) |
| Copy a file. More... | |
| def | mv (self, path_from, path_to, *args, **kwargs) |
| Move a file. More... | |
| def | rm (self, filename, rmdir=False, *args, **kwargs) |
| Remove a file or a directory. More... | |
| def | link (self, target, link_name=None, *args, **kwargs) |
| Make a symbolic link. More... | |
| def | gunzip (self, filename, *args, **kwargs) |
| Unzip a .gz file. More... | |
| def | meshalyzer (self, geom, *args, **kwargs) |
| Run meshalyzer. More... | |
Public Attributes | |
| ID | |
A sequence of commands plus the tools to execute them.
A job defines a series of commands that can be executed in different ways. Each job has an ID, which defines where the output of its commands is placed, plus a series of commands that can either be run immediately as they are registered or delayed for later execution in different ways.
A job is instantiated with its ID:
and its ID can then be accessed as an attribute:
2015-11-25_important_sim
Commands are then registered for the job with the :meth:~Job.register method:
however, for convenience, a number of methods such as :meth:~Job.bash are provided to avoid the need to construct your own commands manually:
On a normal system, commands are executed immeditately once registered (unless the 'delayed' keyword argument is set to True), however on batch systems, commands are stored. The :meth:~Job.script method may then be used to generate a bash script executing the stored commands.
The :meth:~Job.submit method may also be used to automatically generate and submit the job on HPC systems, using the carputils platform.
Users will generally only need to use the convenience submission methods, as the job creation and batch script generation and submission is done automatically by the carputils framework.
| ID | str The identifier for this job, both the name of the output directory and the identifier on batch systems |
| def carputils.job.job.Job.__init__ | ( | self, | |
| ID | |||
| ) |
| def carputils.job.job.Job.bash | ( | self, | |
| cmd, | |||
message = None, |
|||
delayed = False, |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Execute an arbitrary command in the shell.
| cmd | list Command to be executed |
| message | str, optional Descriptive message to display when running command |
| def carputils.job.job.Job.bench | ( | self, | |
| cmd, | |||
simname = None, |
|||
msg = None, |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Execute a BENCH simulation.
Runs a BENCH sim with mpiexec, automatically adding the number of processes and command configuration.
| cmd | list The command to be executed with MPI |
| simname | str, optional Name to display when running command, defaults to job ID |
| def carputils.job.job.Job.carp | ( | self, | |
| cmd, | |||
simname = None, |
|||
polling_subdirs = True, |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Execute an openCARP simulation.
Runs an openCARP sim with mpiexec, automatically adding the number of processes and debugger/profiler options from the current run configuration.
| cmd | list The command to be executed with MPI |
| simname | str, optional Name to display when running command, defaults to job ID |
| def carputils.job.job.Job.cp | ( | self, | |
| path_from, | |||
| path_to, | |||
cpdir = False, |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Copy a file.
| path_from | str Path of file to copy |
| path_to | str Path to copy file to |
| def carputils.job.job.Job.cvstool | ( | self, | |
| cmd, | |||
stdout = None, |
|||
stderr = None, |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Execute cvstool.
| cmd | list The command to be executed with cvstool |
| def carputils.job.job.Job.gunzip | ( | self, | |
| filename, | |||
| * | args, | ||
| ** | kwargs | ||
| ) |
Unzip a .gz file.
| filename | str Path of file to unzip |
| def carputils.job.job.Job.link | ( | self, | |
| target, | |||
link_name = None, |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Make a symbolic link.
| target | str Target of link (first arg to 'ln -s') |
| link_name | str, optional Place to put link (second arg to 'ln -s') |
| def carputils.job.job.Job.meshalyzer | ( | self, | |
| geom, | |||
| * | args, | ||
| ** | kwargs | ||
| ) |
Run meshalyzer.
| geom | str Basename of mesh to visualise |
| args | str Additional data/display config files to pass as command line arguments to meshalyzer |
| compsurf | bool, optional If True, generate a surface on the fly (default: False) |
| monitor | int Delay in seconds before spawning visualization process after job launched (default: none) Return the spawned process. |
| def carputils.job.job.Job.meshtool | ( | self, | |
| cmd, | |||
| * | args, | ||
stdout = None, |
|||
stderr = None, |
|||
| ** | kwargs | ||
| ) |
Execute meshtool.
| cmd | list The command to be executed with meshtool |
| def carputils.job.job.Job.mkdir | ( | self, | |
| directory, | |||
parents = False, |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Make a directory.
| directory | str Path of directory to make |
| parents | bool, optional True to automatically generate parents (mkdir -p) |
| def carputils.job.job.Job.mpi | ( | self, | |
| cmd, | |||
message = 'Executing MPI Command', |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Execute a command with MPI.
Runs a command with mpiexec, automatically adding the number of processes and debugger/profiler options from the current run configuration.
| cmd | list The command to be executed with MPI |
| message | str, optional Descriptive message to display when running command |
| def carputils.job.job.Job.mv | ( | self, | |
| path_from, | |||
| path_to, | |||
| * | args, | ||
| ** | kwargs | ||
| ) |
Move a file.
| path_from | str Path of file to move |
| path_to | str Path to move file to |
| def carputils.job.job.Job.python | ( | self, | |
| cmd, | |||
| * | args, | ||
| ** | kwargs | ||
| ) |
Execute a python script.
Runs a pythonCARP sim with mpiexec, automatically adding the number of processes and debugger/profiler options from the current run configuration.
| cmd | callable The function to be executed with python |
| def carputils.job.job.Job.register | ( | self, | |
| command, | |||
delayed = False |
|||
| ) |
Register a command to be executed.
| command | carputils.job.command.Command The command object |
| delayed | bool, optional If True, never execute immediately - instead wait until first non- delayed command before processing the whole series |
| def carputils.job.job.Job.rm | ( | self, | |
| filename, | |||
rmdir = False, |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Remove a file or a directory.
| filename | str Path of file to remove |
| rmdir | str Set to True if removing directory |
| def carputils.job.job.Job.script | ( | self | ) |
Generate a bash script running the command sequence.
| def carputils.job.job.Job.submit | ( | self, | |
argv = None |
|||
| ) |
Submit the command sequence to the batch system.
| argv | list, optional If provided, include the command line in the generated script, for |
| providence |
| carputils.job.job.Job.ID |