Skip to content

Commit ec87414

Browse files
author
Daniel Morcuende
authored
Merge pull request #317 from cta-observatory/slurm-account
Use the SLURM account specified in the cfg also for the gainsel and autocloser jobs
2 parents 86eaca1 + 5301397 commit ec87414

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/osa/scripts/closer.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ def merge_dl1_datacheck(seq_list) -> List[str]:
336336

337337
muons_dir = destination_dir("MUON", create_dir=False)
338338
datacheck_dir = destination_dir("DATACHECK", create_dir=False)
339+
slurm_account = cfg.get("SLURM", "ACCOUNT")
339340

340341
list_job_id = []
341342

@@ -344,6 +345,7 @@ def merge_dl1_datacheck(seq_list) -> List[str]:
344345
cmd = [
345346
"sbatch",
346347
"--parsable",
348+
f"--account={slurm_account}",
347349
"-D",
348350
options.directory,
349351
"-o",
@@ -386,13 +388,15 @@ def extract_provenance(seq_list):
386388
log.info("Extract provenance run wise")
387389

388390
nightdir = date_to_dir(options.date)
391+
slurm_account = cfg.get("SLURM", "ACCOUNT")
389392

390393
for sequence in seq_list:
391394
if sequence.type == "DATA":
392395
drs4_pedestal_run_id = str(sequence.drs4_run)
393396
pedcal_run_id = str(sequence.pedcal_run)
394397
cmd = [
395398
"sbatch",
399+
f"--account={slurm_account}",
396400
"-D",
397401
options.directory,
398402
"-o",
@@ -433,13 +437,15 @@ def merge_files(sequence_list, data_level="DL2"):
433437

434438
data_dir = destination_dir(data_level, create_dir=False)
435439
pattern, prefix = get_pattern(data_level)
440+
slurm_account = cfg.get("SLURM", "ACCOUNT")
436441

437442
for sequence in sequence_list:
438443
if sequence.type == "DATA":
439444
merged_file = Path(data_dir) / f"{prefix}_LST-1.Run{sequence.run:05d}.h5"
440445

441446
cmd = [
442447
"sbatch",
448+
f"--account={slurm_account}",
443449
"-D",
444450
options.directory,
445451
"-o",
@@ -467,12 +473,14 @@ def merge_muon_files(sequence_list):
467473

468474
data_dir = destination_dir("MUON", create_dir=False)
469475
pattern, prefix = get_pattern("MUON")
476+
slurm_account = cfg.get("SLURM", "ACCOUNT")
470477

471478
for sequence in sequence_list:
472479
merged_file = Path(data_dir) / f"muons_LST-1.Run{sequence.run:05d}.fits"
473480

474481
cmd = [
475482
"sbatch",
483+
f"--account={slurm_account}",
476484
"-D",
477485
options.directory,
478486
"-o",
@@ -499,10 +507,12 @@ def daily_longterm_cmd(parent_job_ids: List[str]) -> List[str]:
499507
muons_dir = destination_dir("MUON", create_dir=False)
500508
longterm_dir = Path(cfg.get("LST1", "LONGTERM_DIR")) / options.prod_id / nightdir
501509
longterm_output_file = longterm_dir / f"DL1_datacheck_{nightdir}.h5"
510+
slurm_account = cfg.get("SLURM", "ACCOUNT")
502511

503512
return [
504513
"sbatch",
505514
"--parsable",
515+
f"--account={slurm_account}",
506516
"-D",
507517
options.directory,
508518
"-o",
@@ -541,10 +551,12 @@ def cherenkov_transparency_cmd(longterm_job_id: str) -> List[str]:
541551
datacheck_dir = destination_dir("DATACHECK", create_dir=False)
542552
longterm_dir = Path(cfg.get("LST1", "LONGTERM_DIR")) / options.prod_id / nightdir
543553
longterm_datacheck_file = longterm_dir / f"DL1_datacheck_{nightdir}.h5"
554+
slurm_account = cfg.get("SLURM", "ACCOUNT")
544555

545556
return [
546557
"sbatch",
547558
"--parsable",
559+
f"--account={slurm_account}",
548560
"-D",
549561
options.directory,
550562
"-o",

src/osa/scripts/gain_selection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def get_sbatch_script(
114114
):
115115
"""Build the sbatch job pilot script for running the gain selection."""
116116
mem_per_job = cfg.get("SLURM", "MEMSIZE_GAINSEL")
117+
slurm_account = cfg.get("SLURM", "ACCOUNT")
117118
sbatch_script = dedent(
118119
f"""\
119120
#!/bin/bash
@@ -123,6 +124,7 @@ def get_sbatch_script(
123124
#SBATCH --job-name "gain_selection_{run_id:05d}"
124125
#SBATCH --partition=short,long
125126
#SBATCH --mem={mem_per_job}
127+
#SBATCH --account={slurm_account}
126128
"""
127129
)
128130

src/osa/scripts/tests/test_osa_scripts.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import yaml
99

1010
from osa.configs import options
11+
from osa.configs.config import cfg
1112
from osa.scripts.closer import is_sequencer_successful, is_finished_check
1213

1314
ALL_SCRIPTS = [
@@ -326,10 +327,12 @@ def test_daily_longterm_cmd():
326327

327328
job_ids = ["12345", "54321"]
328329
cmd = daily_longterm_cmd(parent_job_ids=job_ids)
330+
slurm_account = cfg.get("SLURM", "ACCOUNT")
329331

330332
expected_cmd = [
331333
"sbatch",
332334
"--parsable",
335+
f"--account={slurm_account}",
333336
"-D",
334337
options.directory,
335338
"-o",

0 commit comments

Comments
 (0)