Commit 390a358715d1ecb64d379d2c1bd0cf01afeae1b8
1 parent
fb5dc2a0
Exists in
master
and in
2 other branches
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
... | ... | @@ -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 | ... | ... |
web/run.py
... | ... | @@ -1163,6 +1163,7 @@ def cache_warmup(): |
1163 | 1163 | Linked to SpaceWeather#edit in swapp.ls to get the default time interval. |
1164 | 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 | 1167 | before = relativedelta(months=2) |
1167 | 1168 | after = relativedelta(months=1) |
1168 | 1169 | today = datetime.datetime.now().replace(hour=0, minute=0, second=0) |
... | ... | @@ -1179,7 +1180,10 @@ def cache_warmup(): |
1179 | 1180 | targets_slugs.sort() |
1180 | 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 | 1189 | @app.route("/log") | ... | ... |