Commit 390a358715d1ecb64d379d2c1bd0cf01afeae1b8

Authored by Goutte
1 parent fb5dc2a0

Add a CRON configuration example to `res/`. Improve the warmup a little.

Showing 2 changed files with 10 additions and 1 deletions   Show diff stats
res/crontab_example.txt 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +# Lance la tâche 'clear' pour vider le cache ( dans HELIOPROPA/cache ) toutes les nuits à 2h
  2 +0 2 * * * wget -O /dev/null http://heliopropa.irap.omp.eu/cache/clear &> /dev/null
  3 +
  4 +# Lance la tâche 'warmup' pour remplir le cache ( dans HELIOPROPA/cache ) toutes les nuits à 2h15
  5 +15 2 * * * wget -O /dev/null http://heliopropa.irap.omp.eu/cache/warmup &> /dev/null
@@ -1163,6 +1163,7 @@ def cache_warmup(): @@ -1163,6 +1163,7 @@ def cache_warmup():
1163 Linked to SpaceWeather#edit in swapp.ls to get the default time interval. 1163 Linked to SpaceWeather#edit in swapp.ls to get the default time interval.
1164 If you edit this code you'll need to edit the other as well and vice versa. 1164 If you edit this code you'll need to edit the other as well and vice versa.
1165 """ 1165 """
  1166 + warmup_started_at = datetime.datetime.now()
1166 before = relativedelta(months=2) 1167 before = relativedelta(months=2)
1167 after = relativedelta(months=1) 1168 after = relativedelta(months=1)
1168 today = datetime.datetime.now().replace(hour=0, minute=0, second=0) 1169 today = datetime.datetime.now().replace(hour=0, minute=0, second=0)
@@ -1179,7 +1180,10 @@ def cache_warmup(): @@ -1179,7 +1180,10 @@ def cache_warmup():
1179 targets_slugs.sort() 1180 targets_slugs.sort()
1180 download_targets_cdf('-'.join(targets_slugs), inp, sta, sto) 1181 download_targets_cdf('-'.join(targets_slugs), inp, sta, sto)
1181 1182
1182 - return "Done" 1183 + warmup_ended_at = datetime.datetime.now()
  1184 + warmup_timedelta = warmup_ended_at - warmup_started_at
  1185 +
  1186 + return "Done in %s." % str(warmup_timedelta)
1183 1187
1184 1188
1185 @app.route("/log") 1189 @app.route("/log")