From d87bc9642be5e0464b24433eba6f7126caf6bc59 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Tue, 7 Apr 2020 19:50:07 +0200 Subject: [PATCH] run cron jobs at time specified in settings --- smash/web/importer/exporter_cron_job.py | 4 ++-- smash/web/importer/importer_cron_job.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/smash/web/importer/exporter_cron_job.py b/smash/web/importer/exporter_cron_job.py index 90ce95a6..1d6d7682 100644 --- a/smash/web/importer/exporter_cron_job.py +++ b/smash/web/importer/exporter_cron_job.py @@ -14,8 +14,8 @@ logger = logging.getLogger(__name__) class ExporterCronJob(CronJobBase): - RUN_EVERY_MINUTES = 60 * 24 - schedule = Schedule(run_every_mins=RUN_EVERY_MINUTES) + RUN_AT_TIMES = getattr(settings, "EXPORT_RUN_AT", ['23:55']) + schedule = Schedule(run_at_times=RUN_AT_TIMES) code = 'web.import_daily_job' # a unique code @timeout_decorator.timeout(CRON_JOB_TIMEOUT) diff --git a/smash/web/importer/importer_cron_job.py b/smash/web/importer/importer_cron_job.py index 36df103a..ef0bfd12 100644 --- a/smash/web/importer/importer_cron_job.py +++ b/smash/web/importer/importer_cron_job.py @@ -18,7 +18,7 @@ logger = logging.getLogger(__name__) class ImporterCronJob(CronJobBase): - RUN_AT_TIMES = ['23:55'] + RUN_AT_TIMES = getattr(settings, "IMPORT_RUN_AT", ['23:55']) schedule = Schedule(run_at_times=RUN_AT_TIMES) code = 'web.import_daily_job' # a unique code -- GitLab