Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
ad1f2655
Unverified
Commit
ad1f2655
authored
May 30, 2020
by
Gautier D
Committed by
Florent Chehab
May 31, 2020
Browse files
fix(backend): add missing argument num to the new cron task
parent
f0be1be1
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/cron_tasks.py
View file @
ad1f2655
...
...
@@ -11,17 +11,15 @@ django.setup()
import
logging
# 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
external_data.management.commands.utils
import
FixerData
,
UtcData
# noqa: E402
from
base_app.management.commands.clean_user_accounts
import
(
ClearUserAccounts
,
ClearSessions
,
from
_cron_tasks
import
(
clear_and_clean_sessions
,
update_daily_stats
,
update_currencies
,
update_extra_denormalization
,
update_utc_ent
,
)
# noqa: E402
from
stats_app.compute_stats
import
update_all_stats
# noqa: E402
logger
=
logging
.
getLogger
(
"django"
)
...
...
@@ -29,31 +27,29 @@ logger = logging.getLogger("django")
# @timer(60, target="spooler") # use this for tests
@
timer
(
3
*
60
*
60
,
target
=
"spooler"
)
# run it three hours
@
harakiri
(
40
)
def
update_currencies
(
num
):
FixerData
().
update
()
def
_
update_currencies
(
num
):
update_currencies
()
@
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
def
update_utc_ent
(
num
):
UtcData
().
update
()
def
_
update_utc_ent
(
num
):
update_utc_ent
()
@
timer
(
60
*
60
,
target
=
"spooler"
)
# run it every hour
@
harakiri
(
60
)
def
update_extra_denormalization
(
num
):
update_denormalized_univ_major_minor
()
update_denormalized_univ_field
()
def
_update_extra_denormalization
(
num
):
update_extra_denormalization
()
@
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
def
clear_and_clean_sessions
(
num
):
ClearUserAccounts
.
run
()
ClearSessions
.
run
()
def
_clear_and_clean_sessions
(
num
):
clear_and_clean_sessions
()
@
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
def
update_daily_stats
():
update_
all
_stats
()
def
_
update_daily_stats
(
num
):
update_
daily
_stats
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment