Skip to content

Commit

Permalink
Improve slurm execution launcher configurability
Browse files Browse the repository at this point in the history
  • Loading branch information
frthjf committed Apr 4, 2024
1 parent 209d547 commit dbcf41b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/examples/slurm-execution/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class Config(BaseModel):

preamble: Optional[str] = ""
mpi: Optional[str] = "mpirun"
mpi_args: str = ""
python: Optional[str] = None
throttle: float = 0.5
confirm: bool = True
copy_project_source: bool = True
Expand Down Expand Up @@ -157,6 +159,8 @@ def __call__(self):

resources = self.computed_resources(executable)
mpi = executable.config.get("mpi", self.config.mpi)
mpi_args = executable.config.get("mpi_args", self.config.mpi_args)
python = self.config.python or sys.executable

# usage dependencies
if "--dependency" not in resources and (
Expand Down Expand Up @@ -198,9 +202,14 @@ def __call__(self):
if mpi:
if mpi[-1] != " ":
mpi += " "
script += mpi
mpi = mpi + mpi_args
if mpi[-1] != " ":
mpi += " "
python = mpi + python

script += executable.dispatch_code(project_directory=source_code)
script += executable.dispatch_code(
project_directory=source_code, python=python
)

print(f"Submitting job {executable} with resources: ")
print(yaml.dump(resources))
Expand Down

0 comments on commit dbcf41b

Please sign in to comment.