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
33 changes: 33 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,39 @@ jobs:
pip install . --no-deps --no-build-isolation
python -m unittest discover tests

unittest_slurm:
needs: [black]
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- "8888:3306"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
- uses: koesterlab/setup-slurm-action@v1
timeout-minutes: 5
- name: Conda config
run: echo -e "channels:\n - conda-forge\n" > .condarc
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: "3.13"
miniforge-version: latest
condarc-file: .condarc
environment-file: .ci_support/environment.yml
- name: Test
shell: bash -l {0}
timeout-minutes: 5
run: |
pip install . --no-deps --no-build-isolation
cd tests
sinfo -o "%n %e %m %a %c %C"
srun --mpi=list
python -m unittest test_slurm_integration.py

autobot:
needs: [unittest_old, unittest_matrix, pip_check, notebooks, minimal, coverage]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add new integration jobs to autobot dependencies.

The new integration test jobs should be included in the autobot dependencies to ensure they gate automated merges for bot PRs.

-    needs: [unittest_old, unittest_matrix, pip_check, notebooks, minimal, coverage]
+    needs: [unittest_old, unittest_matrix, pip_check, notebooks, minimal, coverage, unittest_slurm, unittest_flux]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
needs: [unittest_old, unittest_matrix, pip_check, notebooks, minimal, coverage]
needs: [unittest_old, unittest_matrix, pip_check, notebooks, minimal, coverage, unittest_slurm, unittest_flux]
🤖 Prompt for AI Agents
In .github/workflows/pipeline.yml at line 280, the 'needs' array for the autobot
job is missing the new integration test jobs. Add the new integration test job
names to the 'needs' list to ensure these tests are completed before the autobot
job runs, properly gating automated merges for bot PRs.

permissions:
Expand Down
10 changes: 10 additions & 0 deletions tests/test_flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,13 @@ def test_flux_integration(self):
self.assertEqual(self.flux.get_status_of_job(process_id=job_id), "running")
self.flux.delete_job(process_id=job_id)
self.assertEqual(self.flux.get_status_of_job(process_id=job_id), "error")

def test_flux_integration_dynamic(self):
flux_dynamic = QueueAdapter(queue_type="flux")
job_id = flux_dynamic.submit_job(
cores=1,
command="sleep 1",
)
self.assertEqual(flux_dynamic.get_status_of_job(process_id=job_id), "running")
flux_dynamic.delete_job(process_id=job_id)
self.assertEqual(flux_dynamic.get_status_of_job(process_id=job_id), "error")
32 changes: 32 additions & 0 deletions tests/test_slurm_integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import unittest
import shutil
from pysqa import QueueAdapter

if shutil.which("srun") is not None:
skip_slurm_test = False
else:
skip_slurm_test = True


submission_template = """\
#!/bin/bash
#SBATCH --output=time.out
#SBATCH --job-name={{job_name}}
#SBATCH --chdir={{working_directory}}
#SBATCH --get-user-env=L
#SBATCH --ntasks={{cores}}

{{command}}
"""


@unittest.skipIf(
skip_slurm_test, "SLURM is not installed, so the slurm tests are skipped.",
)
class TestSlurm(unittest.TestCase):
def test_slurm(self):
slurm_dynamic = QueueAdapter(queue_type="slurm")
job_id = slurm_dynamic.submit_job(command="sleep 1", cores=1, submission_template=submission_template)
self.assertEqual(slurm_dynamic.get_status_of_job(process_id=job_id), "pending")
slurm_dynamic.delete_job(process_id=job_id)
self.assertIsNone(slurm_dynamic.get_status_of_job(process_id=job_id))
Loading