From d22ec75d888c56486ea83e9c9a3719b9ea80721b Mon Sep 17 00:00:00 2001 From: Daniel Morcuende Date: Wed, 11 May 2022 16:07:56 +0200 Subject: [PATCH 1/2] avoid running reprocessings during nighttime --- osa/scripts/reprocessing.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/osa/scripts/reprocessing.py b/osa/scripts/reprocessing.py index 2598bfc1..8ca20cf4 100644 --- a/osa/scripts/reprocessing.py +++ b/osa/scripts/reprocessing.py @@ -7,7 +7,7 @@ import click -from osa.paths import DEFAULT_CFG +from osa.configs.config import DEFAULT_CFG from osa.utils.logging import myLogger log = myLogger(logging.getLogger(__name__)) @@ -53,6 +53,16 @@ def get_list_of_dates(dates_file): return list_of_dates +def wait_for_daytime(): + """ + Check every hour if it is still nighttime + to not running jobs while it is still night. + """ + while time.localtime().tm_hour <= 6 or time.localtime().tm_hour >= 18: + log.info("Waiting for sunrise to not interfere with the data-taking. Sleeping.") + time.sleep(3600) + + @click.command() @click.option( "--no-dl2", @@ -91,6 +101,9 @@ def main( check_job_status_and_wait() for date in list_of_dates: + # Avoid running jobs while it is still night + wait_for_daytime() + run_script(script, date, config, no_dl2, simulate) log.info("Waiting 1 minute to launch the process for the next date...\n") time.sleep(60) From 15e6401a494218ea608a125f27ab22aed035c4fa Mon Sep 17 00:00:00 2001 From: Daniel Morcuende Date: Wed, 11 May 2022 16:26:20 +0200 Subject: [PATCH 2/2] avoid reprocessing during night --- osa/scripts/reprocessing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osa/scripts/reprocessing.py b/osa/scripts/reprocessing.py index 8ca20cf4..e06855d2 100644 --- a/osa/scripts/reprocessing.py +++ b/osa/scripts/reprocessing.py @@ -101,7 +101,7 @@ def main( check_job_status_and_wait() for date in list_of_dates: - # Avoid running jobs while it is still night + # Avoid running jobs while it is still night time wait_for_daytime() run_script(script, date, config, no_dl2, simulate)