lstosa 0.10.7__tar.gz → 0.10.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lstosa-0.10.7 → lstosa-0.10.9}/PKG-INFO +2 -2
- {lstosa-0.10.7 → lstosa-0.10.9}/environment.yml +1 -1
- {lstosa-0.10.7 → lstosa-0.10.9}/pyproject.toml +1 -1
- {lstosa-0.10.7 → lstosa-0.10.9}/src/lstosa.egg-info/PKG-INFO +2 -2
- {lstosa-0.10.7 → lstosa-0.10.9}/src/lstosa.egg-info/requires.txt +1 -1
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/_version.py +2 -2
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/conftest.py +8 -1
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/job.py +31 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/paths.py +24 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/closer.py +82 -4
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/tests/test_osa_scripts.py +8 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/.coveragerc +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/.gitignore +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/.mailmap +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/.pre-commit-config.yaml +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/.readthedocs.yml +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/LICENSE +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/MANIFEST.in +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/README.md +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/codemeta.json +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/dev/mysql.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/Makefile +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/_static/logo_lstosa.png +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/authors.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/components/index.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/conf.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/configuration.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/contribute.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/documents/index.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/howto/index.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/index.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/introduction/index.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/introduction/reduction_steps_lstchain.png +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/jobs.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/make.bat +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/nightsummary.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/provenance.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/references.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/reports.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/scripts/index.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/troubleshooting/index.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/utils.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/veto.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/workflow/LSTOSA_flow.png +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/docs/workflow/index.rst +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/extra/example_sequencer.txt +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/extra/history_files/sequence_LST1_04183.history +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/extra/history_files/sequence_LST1_04183_failed.history +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/extra/history_files/sequence_LST1_04183_oneline.history +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/extra/history_files/sequence_LST1_04185.0010.history +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/extra/sacct_output.csv +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/extra/squeue_output.csv +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/setup.cfg +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/lstosa.egg-info/SOURCES.txt +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/lstosa.egg-info/dependency_links.txt +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/lstosa.egg-info/entry_points.txt +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/lstosa.egg-info/top_level.txt +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/configs/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/configs/config.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/configs/datamodel.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/configs/options.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/configs/sequencer.cfg +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/high_level/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/high_level/selection_cuts.toml +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/high_level/significance.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/high_level/tests/test_significance.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/nightsummary/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/nightsummary/database.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/nightsummary/extract.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/nightsummary/nightsummary.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/nightsummary/set_source_coordinates.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/nightsummary/tests/test_database.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/nightsummary/tests/test_extract.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/nightsummary/tests/test_nightsummary.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/nightsummary/tests/test_source_coordinates.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/osadb.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/provenance/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/provenance/capture.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/provenance/config/definition.yaml +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/provenance/config/environment.yaml +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/provenance/config/logger.yaml +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/provenance/io.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/provenance/utils.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/raw.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/report.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/autocloser.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/calibration_pipeline.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/copy_datacheck.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/datasequence.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/gain_selection.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/provprocess.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/reprocess_longterm.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/reprocessing.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/sequencer.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/sequencer_webmaker.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/show_run_summary.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/show_run_summary_tcu.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/simulate_processing.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/tests/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/scripts/update_source_catalog.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/tests/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/tests/test_jobs.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/tests/test_osa.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/tests/test_osadb.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/tests/test_paths.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/tests/test_raw.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/tests/test_report.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/tests/test_veto.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/utils/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/utils/cliopts.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/utils/iofile.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/utils/logging.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/utils/mail.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/utils/register.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/utils/tests/test_iofile.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/utils/tests/test_utils.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/utils/utils.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/version.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/veto.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/webserver/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/webserver/utils.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/workflow/__init__.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/workflow/dl3.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/workflow/stages.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/workflow/tests/test_dl3.py +0 -0
- {lstosa-0.10.7 → lstosa-0.10.9}/src/osa/workflow/tests/test_stages.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lstosa
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.9
|
|
4
4
|
Summary: Onsite analysis pipeline for the CTA LST-1
|
|
5
5
|
Author: María Láinez, José Enrique Ruiz, Lab Saha, Andrés Baquero, José Luis Contreras, Maximilian Linhoff
|
|
6
6
|
Author-email: Daniel Morcuende <dmorcuen@ucm.es>
|
|
@@ -20,7 +20,7 @@ Requires-Python: >=3.9
|
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: astropy~=5.0
|
|
23
|
-
Requires-Dist: lstchain>=0.10.
|
|
23
|
+
Requires-Dist: lstchain>=0.10.7
|
|
24
24
|
Requires-Dist: matplotlib
|
|
25
25
|
Requires-Dist: numpy
|
|
26
26
|
Requires-Dist: pandas
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lstosa
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.9
|
|
4
4
|
Summary: Onsite analysis pipeline for the CTA LST-1
|
|
5
5
|
Author: María Láinez, José Enrique Ruiz, Lab Saha, Andrés Baquero, José Luis Contreras, Maximilian Linhoff
|
|
6
6
|
Author-email: Daniel Morcuende <dmorcuen@ucm.es>
|
|
@@ -20,7 +20,7 @@ Requires-Python: >=3.9
|
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: astropy~=5.0
|
|
23
|
-
Requires-Dist: lstchain>=0.10.
|
|
23
|
+
Requires-Dist: lstchain>=0.10.7
|
|
24
24
|
Requires-Dist: matplotlib
|
|
25
25
|
Requires-Dist: numpy
|
|
26
26
|
Requires-Dist: pandas
|
|
@@ -482,7 +482,14 @@ def datacheck_dl1_files(base_test_dir):
|
|
|
482
482
|
|
|
483
483
|
@pytest.fixture(scope="session")
|
|
484
484
|
def longterm_dir(base_test_dir):
|
|
485
|
-
directory = base_test_dir / "OSA" / "DL1DataCheck_LongTerm" /
|
|
485
|
+
directory = base_test_dir / "OSA" / "DL1DataCheck_LongTerm" / prod_id / date_to_dir(date)
|
|
486
|
+
directory.mkdir(parents=True, exist_ok=True)
|
|
487
|
+
return directory
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
@pytest.fixture(scope="session")
|
|
491
|
+
def longterm_link_latest_dir(base_test_dir):
|
|
492
|
+
directory = base_test_dir / "OSA" / "DL1DataCheck_LongTerm" / "night_wise" / "all"
|
|
486
493
|
directory.mkdir(parents=True, exist_ok=True)
|
|
487
494
|
return directory
|
|
488
495
|
|
|
@@ -702,6 +702,37 @@ def get_sacct_output(sacct_output: StringIO) -> pd.DataFrame:
|
|
|
702
702
|
return sacct_output
|
|
703
703
|
|
|
704
704
|
|
|
705
|
+
def get_closer_sacct_output(sacct_output) -> pd.DataFrame:
|
|
706
|
+
"""
|
|
707
|
+
Fetch the information of jobs in the queue launched by AUTOCLOSER using the sacct
|
|
708
|
+
SLURM output and store it in a pandas dataframe.
|
|
709
|
+
|
|
710
|
+
Returns
|
|
711
|
+
-------
|
|
712
|
+
queue_list: pd.DataFrame
|
|
713
|
+
"""
|
|
714
|
+
sacct_output = pd.read_csv(sacct_output, names=FORMAT_SLURM)
|
|
715
|
+
|
|
716
|
+
# Keep only the jobs corresponding to AUTOCLOSER sequences
|
|
717
|
+
# Until the merging of muon files is fixed, check all jobs except "lstchain_merge_muon_files"
|
|
718
|
+
sacct_output = sacct_output[
|
|
719
|
+
(sacct_output["JobName"].str.contains("lstchain_merge_hdf5_files"))
|
|
720
|
+
| (sacct_output["JobName"].str.contains("lstchain_check_dl1"))
|
|
721
|
+
| (sacct_output["JobName"].str.contains("lstchain_longterm_dl1_check"))
|
|
722
|
+
| (sacct_output["JobName"].str.contains("lstchain_cherenkov_transparency"))
|
|
723
|
+
| (sacct_output["JobName"].str.contains("provproces"))
|
|
724
|
+
]
|
|
725
|
+
|
|
726
|
+
try:
|
|
727
|
+
sacct_output["JobID"] = sacct_output["JobID"].apply(lambda x: x.split("_")[0])
|
|
728
|
+
sacct_output["JobID"] = sacct_output["JobID"].str.strip(".batch").astype(int)
|
|
729
|
+
|
|
730
|
+
except AttributeError:
|
|
731
|
+
log.debug("No job info could be obtained from sacct")
|
|
732
|
+
|
|
733
|
+
return sacct_output
|
|
734
|
+
|
|
735
|
+
|
|
705
736
|
def filter_jobs(job_info: pd.DataFrame, sequence_list: Iterable):
|
|
706
737
|
"""Filter the job info list to get the values of the jobs in the current queue."""
|
|
707
738
|
sequences_info = pd.DataFrame([vars(seq) for seq in sequence_list])
|
|
@@ -18,6 +18,7 @@ from osa.configs.datamodel import Sequence
|
|
|
18
18
|
from osa.utils import utils
|
|
19
19
|
from osa.utils.logging import myLogger
|
|
20
20
|
|
|
21
|
+
|
|
21
22
|
log = myLogger(logging.getLogger(__name__))
|
|
22
23
|
|
|
23
24
|
__all__ = [
|
|
@@ -346,3 +347,26 @@ def create_source_directories(source_list: list, cuts_dir: Path):
|
|
|
346
347
|
if source is not None:
|
|
347
348
|
source_dir = cuts_dir / source
|
|
348
349
|
source_dir.mkdir(parents=True, exist_ok=True)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def get_latest_version_file(longterm_files: List[str]) -> Path:
|
|
353
|
+
"""Get the latest version path of the produced longterm DL1 datacheck files for a given date."""
|
|
354
|
+
return max(
|
|
355
|
+
longterm_files,
|
|
356
|
+
key=lambda path: int(path.parents[1].name.split(".")[1])
|
|
357
|
+
if path.parents[1].name.startswith("v")
|
|
358
|
+
else "",
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def create_longterm_symlink():
|
|
363
|
+
"""If the created longterm DL1 datacheck file corresponds to the latest
|
|
364
|
+
version available, make symlink to it in the "all" common directory."""
|
|
365
|
+
nightdir = utils.date_to_dir(options.date)
|
|
366
|
+
longterm_dir = Path(cfg.get("LST1", "LONGTERM_DIR"))
|
|
367
|
+
linked_longterm_file = longterm_dir / f"night_wise/all/DL1_datacheck_{nightdir}.h5"
|
|
368
|
+
all_longterm_files = longterm_dir.rglob(f"v*/{nightdir}/DL1_datacheck_{nightdir}.h5")
|
|
369
|
+
latest_version_file = get_latest_version_file(all_longterm_files)
|
|
370
|
+
|
|
371
|
+
log.info("Symlink the latest version longterm DL1 datacheck file in the common directory.")
|
|
372
|
+
linked_longterm_file.symlink_to(latest_version_file)
|
|
@@ -8,6 +8,7 @@ import re
|
|
|
8
8
|
import shutil
|
|
9
9
|
import subprocess
|
|
10
10
|
import sys
|
|
11
|
+
import time
|
|
11
12
|
from datetime import datetime, timedelta
|
|
12
13
|
from pathlib import Path
|
|
13
14
|
from typing import Tuple, Iterable, List
|
|
@@ -15,15 +16,21 @@ from typing import Tuple, Iterable, List
|
|
|
15
16
|
from osa import osadb
|
|
16
17
|
from osa.configs import options
|
|
17
18
|
from osa.configs.config import cfg
|
|
18
|
-
from osa.job import
|
|
19
|
+
from osa.job import (
|
|
20
|
+
are_all_jobs_correctly_finished,
|
|
21
|
+
save_job_information,
|
|
22
|
+
run_sacct,
|
|
23
|
+
get_closer_sacct_output
|
|
24
|
+
)
|
|
19
25
|
from osa.nightsummary.extract import extract_runs, extract_sequences
|
|
20
26
|
from osa.nightsummary.nightsummary import run_summary_table
|
|
21
|
-
from osa.paths import destination_dir
|
|
27
|
+
from osa.paths import destination_dir, create_longterm_symlink
|
|
22
28
|
from osa.raw import is_raw_data_available
|
|
23
29
|
from osa.report import start
|
|
24
30
|
from osa.utils.cliopts import closercliparsing
|
|
25
31
|
from osa.utils.logging import myLogger
|
|
26
32
|
from osa.utils.register import register_found_pattern
|
|
33
|
+
from osa.utils.mail import send_warning_mail
|
|
27
34
|
from osa.utils.utils import (
|
|
28
35
|
night_finished_flag,
|
|
29
36
|
is_day_closed,
|
|
@@ -152,10 +159,13 @@ def post_process(seq_tuple):
|
|
|
152
159
|
post_process_files(seq_list)
|
|
153
160
|
|
|
154
161
|
# Merge DL1 datacheck files and produce PDFs. It also produces
|
|
155
|
-
# the daily datacheck report using the longterm script
|
|
162
|
+
# the daily datacheck report using the longterm script, and updates
|
|
163
|
+
# the longterm DL1 datacheck file with the cherenkov_transparency script.
|
|
156
164
|
if cfg.getboolean("lstchain", "merge_dl1_datacheck"):
|
|
157
165
|
list_job_id = merge_dl1_datacheck(seq_list)
|
|
158
|
-
daily_datacheck(daily_longterm_cmd(list_job_id))
|
|
166
|
+
longterm_job_id = daily_datacheck(daily_longterm_cmd(list_job_id))
|
|
167
|
+
cherenkov_transparency(cherenkov_transparency_cmd(longterm_job_id))
|
|
168
|
+
create_longterm_symlink()
|
|
159
169
|
|
|
160
170
|
# Extract the provenance info
|
|
161
171
|
extract_provenance(seq_list)
|
|
@@ -169,6 +179,24 @@ def post_process(seq_tuple):
|
|
|
169
179
|
if not options.no_dl2:
|
|
170
180
|
merge_files(seq_list, data_level="DL2")
|
|
171
181
|
|
|
182
|
+
time.sleep(600)
|
|
183
|
+
|
|
184
|
+
# Check if all jobs launched by autocloser finished correctly
|
|
185
|
+
# before creating the NightFinished.txt file
|
|
186
|
+
n_max = 6
|
|
187
|
+
n = 0
|
|
188
|
+
while not all_closer_jobs_finished_correctly() & n <= n_max:
|
|
189
|
+
log.info(
|
|
190
|
+
"All jobs launched by autocloser did not finished correctly yet. "
|
|
191
|
+
"Checking again in 10 minutes..."
|
|
192
|
+
)
|
|
193
|
+
time.sleep(600)
|
|
194
|
+
n += 1
|
|
195
|
+
|
|
196
|
+
if n > n_max:
|
|
197
|
+
send_warning_mail(date=options.date)
|
|
198
|
+
return False
|
|
199
|
+
|
|
172
200
|
if options.seqtoclose is None:
|
|
173
201
|
database = cfg.get("database", "path")
|
|
174
202
|
if database:
|
|
@@ -466,6 +494,7 @@ def daily_longterm_cmd(parent_job_ids: List[str]) -> List[str]:
|
|
|
466
494
|
|
|
467
495
|
return [
|
|
468
496
|
"sbatch",
|
|
497
|
+
"--parsable",
|
|
469
498
|
"-D",
|
|
470
499
|
options.directory,
|
|
471
500
|
"-o",
|
|
@@ -484,11 +513,60 @@ def daily_datacheck(cmd: List[str]):
|
|
|
484
513
|
log.info("Daily dl1 checks using longterm script.")
|
|
485
514
|
log.debug(f"Executing {stringify(cmd)}")
|
|
486
515
|
|
|
516
|
+
if not options.simulate and not options.test and shutil.which("sbatch") is not None:
|
|
517
|
+
job = subprocess.run(
|
|
518
|
+
cmd,
|
|
519
|
+
encoding="utf-8",
|
|
520
|
+
capture_output=True,
|
|
521
|
+
text=True,
|
|
522
|
+
check=True,
|
|
523
|
+
)
|
|
524
|
+
job_id = job.stdout.strip()
|
|
525
|
+
return job_id
|
|
526
|
+
else:
|
|
527
|
+
log.debug("Simulate launching scripts")
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
def cherenkov_transparency_cmd(longterm_job_id: str) -> List[str]:
|
|
531
|
+
"""Build the cherenkov transparency command."""
|
|
532
|
+
nightdir = date_to_dir(options.date)
|
|
533
|
+
datacheck_dir = destination_dir("DATACHECK", create_dir=False)
|
|
534
|
+
longterm_dir = Path(cfg.get("LST1", "LONGTERM_DIR")) / options.prod_id / nightdir
|
|
535
|
+
longterm_datacheck_file = longterm_dir / f"DL1_datacheck_{nightdir}.h5"
|
|
536
|
+
|
|
537
|
+
return [
|
|
538
|
+
"sbatch",
|
|
539
|
+
"-D",
|
|
540
|
+
options.directory,
|
|
541
|
+
"-o",
|
|
542
|
+
"log/cherenkov_transparency_%j.log",
|
|
543
|
+
f"--dependency=afterok:{longterm_job_id}",
|
|
544
|
+
"lstchain_cherenkov_transparency",
|
|
545
|
+
f"--update-datacheck-file={longterm_datacheck_file}",
|
|
546
|
+
f"--input-dir={datacheck_dir}",
|
|
547
|
+
]
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
def cherenkov_transparency(cmd: List[str]):
|
|
551
|
+
"""Update longterm dl1 check file with cherenkov transparency information."""
|
|
552
|
+
log.info("Update longterm dl1 check file with cherenkov_transparency script.")
|
|
553
|
+
log.debug(f"Executing {stringify(cmd)}")
|
|
554
|
+
|
|
487
555
|
if not options.simulate and not options.test and shutil.which("sbatch") is not None:
|
|
488
556
|
subprocess.run(cmd, check=True)
|
|
489
557
|
else:
|
|
490
558
|
log.debug("Simulate launching scripts")
|
|
491
559
|
|
|
492
560
|
|
|
561
|
+
def all_closer_jobs_finished_correctly():
|
|
562
|
+
"""Check if all the jobs launched by autocloser finished correctly."""
|
|
563
|
+
sacct_output = run_sacct()
|
|
564
|
+
jobs_closer = get_closer_sacct_output(sacct_output)
|
|
565
|
+
if len(jobs_closer[jobs_closer["State"]!="COMPLETED"])==0:
|
|
566
|
+
return True
|
|
567
|
+
else:
|
|
568
|
+
return False
|
|
569
|
+
|
|
570
|
+
|
|
493
571
|
if __name__ == "__main__":
|
|
494
572
|
main()
|
|
@@ -179,6 +179,9 @@ def test_closer(
|
|
|
179
179
|
drs4_time_calibration_files,
|
|
180
180
|
systematic_correction_files,
|
|
181
181
|
merged_run_summary,
|
|
182
|
+
longterm_dir,
|
|
183
|
+
longterm_link_latest_dir,
|
|
184
|
+
daily_datacheck_dl1_files,
|
|
182
185
|
):
|
|
183
186
|
# First assure that the end of night flag is not set and remove it otherwise
|
|
184
187
|
night_finished_flag = Path(
|
|
@@ -198,6 +201,10 @@ def test_closer(
|
|
|
198
201
|
for obs_file in test_observed_data:
|
|
199
202
|
assert obs_file.exists()
|
|
200
203
|
assert merged_run_summary.exists()
|
|
204
|
+
assert longterm_dir.exists()
|
|
205
|
+
assert longterm_link_latest_dir.exists()
|
|
206
|
+
for check_file in daily_datacheck_dl1_files:
|
|
207
|
+
assert check_file.exists()
|
|
201
208
|
|
|
202
209
|
run_program("closer", "-y", "-v", "-t", "-d", "2020-01-17", "LST1")
|
|
203
210
|
closed_seq_file = running_analysis_dir / "sequence_LST1_01809.closed"
|
|
@@ -319,6 +326,7 @@ def test_daily_longterm_cmd():
|
|
|
319
326
|
|
|
320
327
|
expected_cmd = [
|
|
321
328
|
"sbatch",
|
|
329
|
+
"--parsable",
|
|
322
330
|
"-D",
|
|
323
331
|
options.directory,
|
|
324
332
|
"-o",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|