Skip to content

Commit

Permalink
Launch lstchain_cherenkov_transparency.py script as a new step of closer
Browse files Browse the repository at this point in the history
  • Loading branch information
marialainez committed Feb 2, 2024
1 parent 41e7313 commit 604c4c5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/osa/scripts/closer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import shutil
import subprocess
import sys
import time
from datetime import datetime, timedelta
from pathlib import Path
from typing import Tuple, Iterable, List
Expand Down Expand Up @@ -157,6 +158,12 @@ def post_process(seq_tuple):
list_job_id = merge_dl1_datacheck(seq_list)
daily_datacheck(daily_longterm_cmd(list_job_id))

# Wait 5 minutes for the longterm DL1 datacheck file to be produced
time.sleep(300)

# Update longterm DL1 datacheck file with cherenkov_transparency script
cherenkov_transparency()

# Extract the provenance info
extract_provenance(seq_list)

Expand Down Expand Up @@ -490,5 +497,31 @@ def daily_datacheck(cmd: List[str]):
log.debug("Simulate launching scripts")


def cherenkov_transparency():
"""Update longterm dl1 check files with cherenkov transparency information."""
nightdir = date_to_dir(options.date)
datacheck_dir = destination_dir("DATACHECK", create_dir=False)
longterm_dir = Path(cfg.get("LST1", "LONGTERM_DIR")) / options.prod_id / nightdir
longterm_datacheck_file = longterm_dir / f"DL1_datacheck_{nightdir}.h5"

cmd = [
"sbatch",
"-D",
options.directory,
"-o",
"log/cherenkov_transparency_%j.log",
"lstchain_cherenkov_transparency",
f"--update-datacheck-file={longterm_datacheck_file}",
f"--input-dir={datacheck_dir}",
]

log.debug(f"Executing {stringify(cmd)}")

if not options.simulate and not options.test and shutil.which("sbatch") is not None:
subprocess.run(cmd, check=True)

Check warning on line 521 in src/osa/scripts/closer.py

View check run for this annotation

Codecov / codecov/patch

src/osa/scripts/closer.py#L521

Added line #L521 was not covered by tests
else:
log.debug("Simulate launching scripts")


if __name__ == "__main__":
main()

0 comments on commit 604c4c5

Please sign in to comment.