Bases: object
Abstract base class of all processes.
This class defines the interface for processes. Derived classes should overload start(), poll(), and wait(). The first is called to actually launch the sub-process (for instance, an actual call to vasp in ProgramProcess). It receives a dictionary or Communicator instance with a description of how the process should be launched, eg the number of processors, nodes, and so forth. At this point, an external child program will generally be running. The second function, poll(), is called to check whether the sub-process, say VASP, is still running. It returns True if the process is finished. The last function is equivalent to calling poll() until it returns True.
Futhermore, a process can be terminated, killed and cleaned up. In general, a process is used as follows:
# initialized
process = SomeProcess()
# started on a number of processors
process.start(comm)
# checked
try:
if process.poll():
# finished, do something
except Fail as e:
# error, do something
Cleans up behind process instance.
This may mean closing standard input/output file, removing temporary files.. By default, calls cleanup of process, and sets process to None.
Maximum number of restarts.
Number of times process was restarted.
Some derived instances may well restart a failed sub-process. This is how often it has been restarted.
Number of running processes.
For simple processes, this will be one or zero. For multitasking processes this may be something more.
Polls current job.
Returns: | True if the process is finished. |
---|---|
Raises NotStarted: | |
If the process was never launched. |
Currently running process.
This is the sub-process handled by this instance. At the lowest level, it is likely an instance of subprocess.Popen. It may, however, be a further abstraction, such as a ProgramProcess instance.
Starts current job.
Parameters: | comm (Communicator) – Holds information about how to launch an mpi-aware process. |
---|---|
Returns: | True if process is already finished. |
Raises: |
|