libmuscle.native_instantiator.process_manager module

class libmuscle.native_instantiator.process_manager.ProcessManager[source]

Bases: object

Manages a set of running processes.

cancel_all() None[source]

Stops all running processes.

This does not wait for them to terminate, it just sends the signal to kill them.

get_finished() list[tuple[str, int]][source]

Returns names and exit codes of finished processes.

This returns all processes that have finished running since the previous call; each started process will be returned exactly once.

start(name: str, work_dir: Path, args: list[str], env: dict[str, str], stdout: Path, stderr: Path) None[source]

Start a process.

The files that the output is directed to will be overwritten if they already exist.

Parameters:
  • name – Name under which this process will be known

  • work_dir – Working directory in which to start

  • args – Executable and arguments to run

  • env – Environment variables to set

  • stdout – File to redirect stdout to

  • stderr – File to redirect stderr to

Raises:
  • RuntimeError – If there is already a process with the given name.

  • OSError – If the process could not be started.