executorlib.standalone.interactive.spawner.SubprocessSpawner#

class executorlib.standalone.interactive.spawner.SubprocessSpawner(cwd: str | None = None, cores: int = 1, worker_id: int = 0, openmpi_oversubscribe: bool = False, threads_per_core: int = 1)[source]#

Bases: BaseSpawner

__init__(cwd: str | None = None, cores: int = 1, worker_id: int = 0, openmpi_oversubscribe: bool = False, threads_per_core: int = 1)[source]#

Subprocess interface implementation.

Parameters:
  • cwd (str, optional) – The current working directory. Defaults to None.

  • cores (int, optional) – The number of cores to use. Defaults to 1.

  • threads_per_core (int, optional) – The number of threads per core. Defaults to 1.

  • worker_id (int) – The worker ID. Defaults to 0.

  • openmpi_oversubscribe (bool, optional) – Whether to oversubscribe the cores. Defaults to False.

Methods

__init__([cwd, cores, worker_id, ...])

Subprocess interface implementation.

bootup(command_lst[, stop_function])

Method to start the subprocess interface.

generate_command(command_lst)

Method to generate the command list.

poll()

Method to check if the subprocess interface is running.

shutdown([wait])

Method to shutdown the subprocess interface.

bootup(command_lst: list[str], stop_function: Callable | None = None) bool[source]#

Method to start the subprocess interface.

Parameters:
  • command_lst (list[str]) – The command list to execute.

  • stop_function (Callable) – Function to stop the interface.

Returns:

Whether the interface was successfully started.

Return type:

bool

generate_command(command_lst: list[str]) list[str][source]#

Method to generate the command list.

Parameters:

command_lst (list[str]) – The command list.

Returns:

The generated command list.

Return type:

list[str]

poll() bool[source]#

Method to check if the subprocess interface is running.

Returns:

True if the interface is running, False otherwise.

Return type:

bool

shutdown(wait: bool = True)[source]#

Method to shutdown the subprocess interface.

Parameters:

wait (bool, optional) – Whether to wait for the interface to shutdown. Defaults to True.