File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ from logging import getLogger
2
+
3
+ from eatsmart .celery import app
4
+ from eatsmart .locations .durham import api
5
+
6
+
7
+ logger = getLogger (__file__ )
8
+
9
+
10
+ @app .task
11
+ def import_durham_data ():
12
+ """Import Durham data"""
13
+ logger .info ("Starting Durham Import" )
14
+ api .EstablishmentImporter ().run ()
15
+ api .InspectionImporter ().run ()
16
+ api .ViolationImporter ().run ()
17
+ logger .info ("Finished Durham Import" )
Original file line number Diff line number Diff line change 1
1
# Django settings for eatsmart project.
2
2
import os
3
+ from celery .schedules import crontab
4
+
3
5
4
6
PROJECT_PATH = os .path .abspath (os .path .join (os .path .dirname (__file__ ), os .pardir ))
5
7
PROJECT_ROOT = os .path .abspath (os .path .join (PROJECT_PATH , os .pardir ))
222
224
# Default user location
223
225
LATITUDE = 35.988611
224
226
LONGITUDE = - 78.907222
227
+
228
+ CELERYBEAT_SCHEDULE = {
229
+ 'import-durham-data' : {
230
+ 'task' : 'eatsmart.locations.durham.tasks.import_durham_data' ,
231
+ 'schedule' : crontab (minute = 0 , hour = 0 ), # Execute daily at midnight
232
+ },
233
+ }
You can’t perform that action at this time.
0 commit comments