-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjob.py
30 lines (28 loc) · 1.05 KB
/
job.py
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
from venue_meta import VenueMetaCrawler
from venue_meta import VenuePhotoCrawlerFoursquare
from threading import Thread
from time import sleep
class Job():
def __init__(self, venue_ids):
if type(venue_ids) is not list:
raise TypeError
self.status = "Wating"
self.venue_count = 0
self.venue_ids = venue_ids
def submit(self, downloading_locker):
_meta_crawler = VenueMetaCrawler()
_foursqaure_photo_crawler = VenuePhotoCrawlerFoursquare()
for id in self.venue_ids:
self.venue_count += 1
self.status = 'Fetching meta data for venue id = '+str(id)
_meta_crawler.grab_meta_data(id)
#sleep(1)
#self.status = 'Fetching foursquare photo data for venue id = ' +str(id)
#_foursqaure_photo_crawler.grab_photo(id)
#sleep(1)
self.status = 'Finished'
downloading_locker.clear()
return "job done"
def report(self):
return [self.status, self.venue_count]
#print self.status