Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

import os 

 

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "base_app.settings.main") 

import django # noqa: E402 

 

django.setup() 

 

# END OF SETUP 

# DON'T PUT DJANGO RELATED IMPORTS BEFORE THIS 

 

import logging # noqa: E402 

 

from uwsgidecorators import harakiri, cron, timer # noqa: E402 

 

from _cron_tasks import ( 

clear_and_clean_sessions, 

update_daily_stats, 

update_currencies, 

update_extra_denormalization, 

update_utc_ent, 

) # noqa: E402 

 

 

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): 

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): 

update_utc_ent() 

 

 

@timer(60 * 60, target="spooler") # run it every hour 

@harakiri(60) 

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): 

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(num): 

update_daily_stats()