Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .ci_support/environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ dependencies:
- cloudpickle
- mpi4py
- tqdm
- pyzmq
- pyzmq
- flux-core
12 changes: 5 additions & 7 deletions pympipool/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os
import shutil
from ._version import get_versions
from pympipool.mpi.executor import PyMPIExecutor
from pympipool.shared.interface import SLURM_COMMAND
from pympipool.slurm.executor import PySlurmExecutor

try: # The PyFluxExecutor requires flux-core to be installed.
from pympipool.flux.executor import PyFluxExecutor
Expand All @@ -10,13 +13,8 @@
flux_installed = False
pass

try: # The PySlurmExecutor requires the srun command to be available.
from pympipool.slurm.executor import PySlurmExecutor

slurm_installed = True
except ImportError:
slurm_installed = False
pass
# The PySlurmExecutor requires the srun command to be available.
slurm_installed = shutil.which(SLURM_COMMAND) is not None


__version__ = get_versions()["version"]
Expand Down
10 changes: 1 addition & 9 deletions pympipool/slurm/executor.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import shutil
import subprocess


from pympipool.shared.executorbase import (
cloudpickle_register,
execute_parallel_tasks,
ExecutorBase,
executor_broker,
)
from pympipool.shared.interface import SrunInterface, SLURM_COMMAND
from pympipool.shared.interface import SrunInterface
from pympipool.shared.thread import RaisingThread


if shutil.which(SLURM_COMMAND) is None:
raise ImportError("SLURM command " + SLURM_COMMAND + " not found.")


class PySlurmExecutor(ExecutorBase):
"""
The pympipool.slurm.PySlurmExecutor leverages the srun command to distribute python tasks within a SLURM queuing
Expand Down