Skip to content

Slurm - #473

Draft
Gautzilla wants to merge 60 commits into
Project-OSmOSE:mainfrom
Gautzilla:slurm
Draft

Slurm#473
Gautzilla wants to merge 60 commits into
Project-OSmOSE:mainfrom
Gautzilla:slurm

Conversation

@Gautzilla

@Gautzilla Gautzilla commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🍹Slurp the SLURM

This PR aims at adding the osekit.job.scheduler.slurm class, which can be used to submit jobs in a SLURM scheduler.

It'll be developed alongside #465, as some of the code in #465 is still PBS-locked. I'll do some edits in #465 when I feel like some features that I thought were PBS-specific can be moved up in the Scheduler class, and I'll rebase this branch on the Scheduler one from time to time.

In the end, the user should be able to run public transforms in a slurm workload manager easily:

from osekit.job.builder import JobBuilder
from osekit.job.config import JobConfig
from osekit.job.scheduler.slurm import Slurm
from osekit.public.project import Project

project = Project(...)  # See the Project documentation

job_config = JobConfig(...)  # See the JobConfig documentation

scheduler = Slurm(partition="cpu")  # Scheduler in which the job is submitted

project.job_builder = JobBuilder(
    config=job_config,
    scheduler=scheduler,
)

# Now the dataset has a non-None job_builder attribute,
# running a transform will write a SLURM file in the logs directory
# and submit it through the selected scheduler.

project.run(...)  # See the Transform documentation

resolves #279

@Gautzilla
Gautzilla requested a review from mathieudpnt August 31, 2026 08:48
@Gautzilla Gautzilla self-assigned this Aug 31, 2026
@Gautzilla Gautzilla added the Feature A new feature to add to OSEkit label Aug 31, 2026
@coveralls

coveralls commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 99.122% (+0.03%) from 99.089% — Gautzilla:slurm into Project-OSmOSE:main

* change dependencies management

* add full examples coverage in doctest

* update dependency parameter in test_submit_pbs function

* add test function for build dependencies string from string ids in pbs scheduler

* add test function for build dependencies string from jobs in pbs scheduler

* add test function for _validate_dependency_type call in PBS build_dependencies_string

* move dependencies job status validation to dedicated method

* add test for job status validation call on pbs build dependencies string

* add tests for Pbs._vaidate_dependenciesÃ_jobs_status

* remove old all-in-one test function

* remove redundant test

* add missing valid dependency types

* simplify PBS submit erorrs test

* add test for Pbs.validate_dependency_type

* add test for Pbs.validate_job_id

* add docstring for Pbs._parse_job_ids()

* delegate pbs validations to the scheduler

* adapt JobBuilder.submit() test

* remove tests on delegated validation functions

* expose JobBuilder job list in a property

* separate venv instruction string parts with a linebreak

* adapt PBS write test to multiline conda env instruction
@Gautzilla

Gautzilla commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

I still have an issue with Slurm.update_info() since squeue doesn't work as PBS's qstat -X (where both running and completed jobs are listed).

For Slurm, I might have to complete squeue with sacct to account for completed jobs.

While I'm at it I might as well ease the parsing of the info directly in the INFO_CMD part, e.g. for slurm:

sacct --jobs 3647208 --allocations --noheader --parsable2 --format=jobID,Partition,JobName,User,State,Elapsed,NodeList,Reason

Which will replace the full report:

JobID           JobName  Partition    Account  AllocCPUS      State ExitCode
------------ ---------- ---------- ---------- ---------- ---------- --------
3647208            job1        cpu hpc.ifrem+          2  COMPLETED      0:0
3647208.bat+      batch            hpc.ifrem+          2  COMPLETED      0:0
3647208.ext+     extern            hpc.ifrem+          2  COMPLETED      0:0

With a synthetic one:

3647208|cpu|job1|gberthom|COMPLETED|00:02:02|compute-116-7|None

@Gautzilla
Gautzilla force-pushed the slurm branch 2 times, most recently from 2f85f08 to da1fce9 Compare September 7, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature A new feature to add to OSEkit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slurm is the new PBS

2 participants