Unverified Commit ad1f2655 authored by Gautier D's avatar Gautier D Committed by Florent Chehab
Browse files

fix(backend): add missing argument num to the new cron task

parent f0be1be1
...@@ -11,17 +11,15 @@ django.setup() ...@@ -11,17 +11,15 @@ django.setup()
import logging # noqa: E402 import logging # noqa: E402
from uwsgidecorators import harakiri, cron, timer # noqa: E402 from uwsgidecorators import harakiri, cron, timer # noqa: E402
from backend_app.models.exchange import (
update_denormalized_univ_major_minor,
) # noqa: E402
from backend_app.models.university import update_denormalized_univ_field # noqa: E402 from _cron_tasks import (
from external_data.management.commands.utils import FixerData, UtcData # noqa: E402 clear_and_clean_sessions,
from base_app.management.commands.clean_user_accounts import ( update_daily_stats,
ClearUserAccounts, update_currencies,
ClearSessions, update_extra_denormalization,
update_utc_ent,
) # noqa: E402 ) # noqa: E402
from stats_app.compute_stats import update_all_stats # noqa: E402
logger = logging.getLogger("django") logger = logging.getLogger("django")
...@@ -29,31 +27,29 @@ logger = logging.getLogger("django") ...@@ -29,31 +27,29 @@ logger = logging.getLogger("django")
# @timer(60, target="spooler") # use this for tests # @timer(60, target="spooler") # use this for tests
@timer(3 * 60 * 60, target="spooler") # run it three hours @timer(3 * 60 * 60, target="spooler") # run it three hours
@harakiri(40) @harakiri(40)
def update_currencies(num): def _update_currencies(num):
FixerData().update() update_currencies()
@cron(5, 0, -1, -1, -1, target="spooler") # everyday at 5 past midnight @cron(5, 0, -1, -1, -1, target="spooler") # everyday at 5 past midnight
@harakiri(60 * 10) # shouldn't take more than 10 minutes to run @harakiri(60 * 10) # shouldn't take more than 10 minutes to run
def update_utc_ent(num): def _update_utc_ent(num):
UtcData().update() update_utc_ent()
@timer(60 * 60, target="spooler") # run it every hour @timer(60 * 60, target="spooler") # run it every hour
@harakiri(60) @harakiri(60)
def update_extra_denormalization(num): def _update_extra_denormalization(num):
update_denormalized_univ_major_minor() update_extra_denormalization()
update_denormalized_univ_field()
@cron(20, 0, -1, -1, -1, target="spooler") # everyday at 20 past midnight @cron(20, 0, -1, -1, -1, target="spooler") # everyday at 20 past midnight
@harakiri(60 * 5) # shouldn't take more than 5 minutes to run @harakiri(60 * 5) # shouldn't take more than 5 minutes to run
def clear_and_clean_sessions(num): def _clear_and_clean_sessions(num):
ClearUserAccounts.run() clear_and_clean_sessions()
ClearSessions.run()
@cron(30, 0, -1, -1, -1, target="spooler") # everyday at 30 past midnight @cron(30, 0, -1, -1, -1, target="spooler") # everyday at 30 past midnight
@harakiri(60 * 5) # shouldn't take more than 5 minutes to run @harakiri(60 * 5) # shouldn't take more than 5 minutes to run
def update_daily_stats(): def _update_daily_stats(num):
update_all_stats() update_daily_stats()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment