executorlib.task_scheduler.interactive.spawner_flux.FluxPythonSpawner

executorlib.task_scheduler.interactive.spawner_flux.FluxPythonSpawner#

class executorlib.task_scheduler.interactive.spawner_flux.FluxPythonSpawner(cwd: str | None = None, cores: int = 1, threads_per_core: int = 1, gpus_per_core: int = 0, num_nodes: int | None = None, worker_id: int = 0, exclusive: bool = False, priority: int | None = None, openmpi_oversubscribe: bool = False, pmi_mode: str | None = None, flux_executor: FluxExecutor | None = None, flux_executor_nesting: bool = False, flux_log_files: bool = False, run_time_max: int | None = None)[source]#

Bases: BaseSpawner

A class representing the FluxPythonInterface.

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

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

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

  • gpus_per_core (int, optional) – The number of GPUs per base. Defaults to 0.

  • num_nodes (int, optional) – The number of compute nodes to use for executing the task. Defaults to None.

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

  • exclusive (bool) – Whether to exclusively reserve the compute nodes, or allow sharing compute notes. Defaults to False.

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

  • priority (int, optional) – job urgency 0 (lowest) through 31 (highest) (default is 16). Priorities 0 through 15 are restricted to the instance owner.

  • pmi_mode (str, optional) – The PMI option. Defaults to None.

  • flux_executor (flux.job.FluxExecutor, optional) – The FluxExecutor instance. Defaults to None.

  • flux_executor_nesting (bool, optional) – Whether to use nested FluxExecutor. Defaults to False.

  • flux_log_files (bool, optional) – Write flux stdout and stderr files. Defaults to False.

  • run_time_max (int) – The maximum runtime in seconds for each task. Default: None

__init__(cwd: str | None = None, cores: int = 1, threads_per_core: int = 1, gpus_per_core: int = 0, num_nodes: int | None = None, worker_id: int = 0, exclusive: bool = False, priority: int | None = None, openmpi_oversubscribe: bool = False, pmi_mode: str | None = None, flux_executor: FluxExecutor | None = None, flux_executor_nesting: bool = False, flux_log_files: bool = False, run_time_max: int | None = None)[source]#

Base class for interface implementations.

Parameters:
  • cwd (str) – The current working directory.

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

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

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

Methods

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

Base class for interface implementations.

bootup(command_lst[, stop_function])

Boot up the client process to connect to the SocketInterface.

poll()

Check if the FluxPythonInterface is running.

shutdown([wait])

Shutdown the FluxPythonInterface.

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

Boot up the client process to connect to the SocketInterface.

Parameters:
  • command_lst (list[str]) – List of strings to start the client process.

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

Raises:

ValueError – If oversubscribing is not supported for the Flux adapter or if conda environments are not supported.

Returns:

Whether the interface was successfully started.

Return type:

bool

poll()[source]#

Check if the FluxPythonInterface is running.

Returns:

True if the interface is running, False otherwise.

Return type:

bool

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

Shutdown the FluxPythonInterface.

Parameters:

wait (bool, optional) – Whether to wait for the execution to complete. Defaults to True.