Skip to content

Commit

Permalink
test: slurm mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Nov 25, 2024
1 parent 4256763 commit 48c9741
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ccbr_tools/pipeline/nextflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def run(
mode="local",
pipeline_name=None,
debug=False,
hpc=get_hpc(),
):
"""
Run a Nextflow workflow
Expand All @@ -33,7 +34,6 @@ def run(
"""
nextflow_command = ["nextflow", "run", nextfile_path]

hpc = get_hpc()
if mode == "slurm" and not hpc:
raise ValueError("mode is 'slurm' but no HPC environment was detected")
# add any additional Nextflow commands
Expand Down
28 changes: 23 additions & 5 deletions tests/test_nextflow.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
from ccbr_tools.pipeline.nextflow import run
from ccbr_tools.pipeline.hpc import get_hpc
from ccbr_tools.pipeline.hpc import get_hpc, Biowulf, FRCE
from ccbr_tools.shell import exec_in_context

import tempfile


def test_nextflow_basic():
output = exec_in_context(run, "CCBR/CHAMPAGNE", debug=True)
assert "nextflow run CCBR/CHAMPAGNE" in output


def test_nextflow_hpc():
hpc = get_hpc()
if hpc.name == "biowulf" or hpc.name == "frce":
output = exec_in_context(run, "CCBR/CHAMPAGNE", debug=True)
assert "module load" in output
assert all(
[
"module load"
in exec_in_context(run, "CCBR/CHAMPAGNE", debug=True, hpc=Biowulf()),
"module load"
in exec_in_context(run, "CCBR/CHAMPAGNE", debug=True, hpc=FRCE()),
]
)


def test_nextflow_slurm():
assert "sbatch submit_slurm.sh" in exec_in_context(
run, "CCBR/CHAMPAGNE", debug=True, hpc=Biowulf(), mode="slurm"
)


if __name__ == "__main__":
print(
exec_in_context(run, "CCBR/CHAMPAGNE", debug=True, hpc=Biowulf(), mode="slurm")
)

0 comments on commit 48c9741

Please sign in to comment.