Skip to content

Commit fd8174e

Browse files
authored
Merge pull request #293 from cta-observatory/gainsel_automation
Improvements for gain selection automation
2 parents 6ab636c + d32dbba commit fd8174e

File tree

6 files changed

+435
-193
lines changed

6 files changed

+435
-193
lines changed

Diff for: src/osa/configs/sequencer.cfg

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ dl1_to_dl2: lstchain_dl1_to_dl2
5555
dl1a_config: /software/lstchain/data/lstchain_standard_config.json
5656
store_image_dl1ab: True
5757
merge_dl1_datacheck: True
58+
use_ff_heuristic_gain_selection: False
5859
dl1b_config: /software/lstchain/data/lstchain_standard_config.json
5960
dl2_config: /software/lstchain/data/lstchain_standard_config.json
6061
rf_models: /data/models/prod5/zenith_20deg/20201023_v0.6.3
@@ -71,7 +72,8 @@ electron: /path/to/DL2/electron_mc_testing.h5
7172
PARTITION_PEDCALIB: short, long
7273
PARTITION_DATA: short, long
7374
MEMSIZE_PEDCALIB: 3GB
74-
MEMSIZE_DATA: 16GB
75+
MEMSIZE_DATA: 6GB
76+
MEMSIZE_GAINSEL: 2GB
7577
WALLTIME: 1:15:00
7678
# Days from current day up to which the jobs are fetched from the queue.
7779
# Default is None (left empty).

Diff for: src/osa/job.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ def get_squeue_output(squeue_output: StringIO) -> pd.DataFrame:
653653
return df
654654

655655

656-
def run_sacct() -> StringIO:
656+
def run_sacct(job_id: str = None) -> StringIO:
657657
"""Run sacct to obtain the job information."""
658658
if shutil.which("sacct") is None:
659659
log.warning("No job info available since sacct command is not available")
@@ -668,13 +668,18 @@ def run_sacct() -> StringIO:
668668
"-o",
669669
",".join(FORMAT_SLURM),
670670
]
671+
672+
if job_id:
673+
sacct_cmd.append("--jobs")
674+
sacct_cmd.append(job_id)
675+
671676
if cfg.get("SLURM", "STARTTIME_DAYS_SACCT"):
672677
days = int(cfg.get("SLURM", "STARTTIME_DAYS_SACCT"))
673678
start_date = (datetime.date.today() - datetime.timedelta(days=days)).isoformat()
674679
sacct_cmd.extend(["--starttime", start_date])
675680

676681
return StringIO(sp.check_output(sacct_cmd).decode())
677-
682+
678683

679684
def get_sacct_output(sacct_output: StringIO) -> pd.DataFrame:
680685
"""
@@ -809,3 +814,12 @@ def update_sequence_state(sequence, filtered_job_info: pd.DataFrame) -> None:
809814
sequence.exit = "0:15"
810815
elif any("RUNNING" in job for job in filtered_job_info.State):
811816
sequence.state = "RUNNING"
817+
818+
819+
def job_finished_in_timeout(job_id: str) -> bool:
820+
"""Return True if the input job_id finished in TIMEOUT state."""
821+
job_status = get_sacct_output(run_sacct(job_id=job_id))["State"]
822+
if job_id and job_status.item() == "TIMEOUT":
823+
return True
824+
else:
825+
return False

0 commit comments

Comments
 (0)