42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
from ..automation.notification import NotificationExec
|
|
from ..automation.mautic import Mautic
|
|
from django_cron import CronJobBase, Schedule
|
|
import datetime
|
|
|
|
class NotificationJob(CronJobBase):
|
|
notif = NotificationExec()
|
|
RUN_EVERY_MINS = 5
|
|
schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
|
|
code = 'aitrainer_backoffice.controlling.notification' # a unique code
|
|
|
|
def do(self):
|
|
print(datetime.datetime.now(), " *** START notification ")
|
|
self.notif.run()
|
|
print(datetime.datetime.now(), " *** END notification ")
|
|
|
|
|
|
class TrialJob(CronJobBase):
|
|
RUN_EVERY_MINS = 60
|
|
schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
|
|
code = 'aitrainer_backoffice.controlling.trial_sync' # a unique code
|
|
|
|
def do(self):
|
|
print(datetime.datetime.now(), " *** START trial sync ")
|
|
mautic = Mautic()
|
|
mautic.syncTrial()
|
|
print(datetime.datetime.now(), " *** END trial sync ")
|
|
|
|
|
|
class LangJob(CronJobBase):
|
|
RUN_EVERY_MINS = 60
|
|
schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
|
|
code = 'aitrainer_backoffice.controlling.Lang_sync' # a unique code
|
|
|
|
def do(self):
|
|
print(datetime.datetime.now(), " *** START Lang sync ")
|
|
mautic = Mautic()
|
|
mautic.syncLang()
|
|
print(datetime.datetime.now(), " *** END Lang sync ")
|
|
|
|
|