Skip to content

Commit

Permalink
Merge pull request #300 from cta-observatory/slurm-account
Browse files Browse the repository at this point in the history
Add option in the cfg to select the SLURM account
  • Loading branch information
morcuended authored Aug 7, 2024
2 parents 1151579 + d042480 commit c1c1039
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/osa/configs/sequencer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ WALLTIME: 1:15:00
# Days from current day up to which the jobs are fetched from the queue.
# Default is None (left empty).
STARTTIME_DAYS_SACCT:
ACCOUNT: dpps

[WEBSERVER]
# Set the server address and port to transfer the datacheck plots
Expand Down
1 change: 1 addition & 0 deletions src/osa/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ def scheduler_env_variables(sequence, scheduler="slurm"):

sbatch_parameters.append(f"--partition={cfg.get('SLURM', f'PARTITION_{sequence.type}')}")
sbatch_parameters.append(f"--mem-per-cpu={cfg.get('SLURM', f'MEMSIZE_{sequence.type}')}")
sbatch_parameters.append(f"--account={cfg.get('SLURM', 'ACCOUNT')}")

return ["#SBATCH " + line for line in sbatch_parameters]

Expand Down
10 changes: 8 additions & 2 deletions src/osa/tests/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def test_scheduler_env_variables(sequence_list, running_analysis_dir):
"#SBATCH --error=log/Run01809.%4a_jobid_%A.err",
f'#SBATCH --partition={cfg.get("SLURM", "PARTITION_PEDCALIB")}',
"#SBATCH --mem-per-cpu=3GB",
"#SBATCH --account=dpps",
]
# Extract the second sequence
second_sequence = sequence_list[1]
Expand All @@ -84,6 +85,7 @@ def test_scheduler_env_variables(sequence_list, running_analysis_dir):
"#SBATCH --array=0-10",
f'#SBATCH --partition={cfg.get("SLURM", "PARTITION_DATA")}',
"#SBATCH --mem-per-cpu=16GB",
"#SBATCH --account=dpps",
]


Expand All @@ -104,7 +106,8 @@ def test_job_header_template(sequence_list, running_analysis_dir):
#SBATCH --output=log/Run01809.%4a_jobid_%A.out
#SBATCH --error=log/Run01809.%4a_jobid_%A.err
#SBATCH --partition={cfg.get('SLURM', 'PARTITION_PEDCALIB')}
#SBATCH --mem-per-cpu=3GB"""
#SBATCH --mem-per-cpu=3GB
#SBATCH --account=dpps"""
)
assert header == output_string1

Expand All @@ -122,7 +125,8 @@ def test_job_header_template(sequence_list, running_analysis_dir):
#SBATCH --error=log/Run01807.%4a_jobid_%A.err
#SBATCH --array=0-10
#SBATCH --partition={cfg.get('SLURM', 'PARTITION_DATA')}
#SBATCH --mem-per-cpu=16GB"""
#SBATCH --mem-per-cpu=16GB
#SBATCH --account=dpps"""
)
assert header == output_string2

Expand Down Expand Up @@ -154,6 +158,7 @@ def test_create_job_template_scheduler(
#SBATCH --array=0-10
#SBATCH --partition={cfg.get('SLURM', 'PARTITION_DATA')}
#SBATCH --mem-per-cpu={cfg.get('SLURM', 'MEMSIZE_DATA')}
#SBATCH --account={cfg.get('SLURM', 'ACCOUNT')}
import os
import subprocess
Expand Down Expand Up @@ -199,6 +204,7 @@ def test_create_job_template_scheduler(
#SBATCH --array=0-8
#SBATCH --partition={cfg.get('SLURM', 'PARTITION_DATA')}
#SBATCH --mem-per-cpu={cfg.get('SLURM', 'MEMSIZE_DATA')}
#SBATCH --account={cfg.get('SLURM', 'ACCOUNT')}
import os
import subprocess
Expand Down

0 comments on commit c1c1039

Please sign in to comment.