Manages external processes and jobfolders.
This sub-module provides an abstraction between resources which purports to launch external programs, say a Vasp instance, and the actual program. There are two main issues the module attempts to resolve:
- an interface which hides the details of launching mpi jobs on one or another super-computer
- an interface to launch different calculations in parallel but from a single actual system process, e.g. asynchronous management of different mpi-processes
The first point above is easy to understand: some machines use openmpi as is, others provide different flavors of mpich, and Cray use their own crap pseudo-proprietary software. It’s best to keep all those details in one place. The second point is to make it easy to launch different calculations simultaneously. It provides an additional layer for parallelization, in addition to the one provided below at the application level by mpich and friends, and above it by the queuing system of a particular super-computer.
The module is organized around Process and its derived classes. Instances of these classes are meant to be used as follows:
process = SomeProcess()
process.start(comm)
# do something else
try:
if process.poll():
# process did finish.
except Fail as e:
# an error occured
The first two lines initialize and start a process of some kind, which could be as simple as lauching an external program or as complicated as lauching different jobs from a JobFolder instance in parallel. The rest of the snippet checks whether the process is finished. If it finished correctly, then poll() (rather, the overloaded functions in the derived class) returns True. Otherwise, it throws Fail.
It is expected that processes will be returned (or yielded) by functionals, and then further managed by the script of interest. As such, the initialization of a process will depend upon the actual functional, and what it purports to do. However, it should be possible from then on to manage the process in a standard way. This standard interface is described by the abstract base class Process.
Bases: pylada.error.root
Root of special exceptions issued by process module.
Bases: pylada.process.ProcessError
Process failed to run successfully.
Bases: pylada.process.ProcessError
Process already started.
Thrown when start() or its overloaded friend is called for a second time.
Bases: pylada.process.ProcessError
Process was never started.
Thrown when poll() or its overloaded friend is called before the process is started.