Subversion Repositories SmartDukaan

Rev

Rev 14209 | Rev 14254 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14209 Rev 14252
Line 33... Line 33...
33
    for bestSeller in bestSellers: 
33
    for bestSeller in bestSellers: 
34
        snapdealBestSellers = list(get_mongo_connection().Catalog.MasterData.find({'skuBundleId':bestSeller['skuBundleId'],'source_id':3}))
34
        snapdealBestSellers = list(get_mongo_connection().Catalog.MasterData.find({'skuBundleId':bestSeller['skuBundleId'],'source_id':3}))
35
        for data in snapdealBestSellers:
35
        for data in snapdealBestSellers:
36
            if not toScrapMap.has_key(data['_id']):
36
            if not toScrapMap.has_key(data['_id']):
37
                toScrapMap[data['_id']] = data
37
                toScrapMap[data['_id']] = data
38
    for k, y in toScrapMap.iteritems():
38
    dealFlagged = list(get_mongo_connection().Catalog.Deals.find({'source_id':3,'showDeal':1,'totalPoints':{'$gt':0}}))
39
        print k,
39
    for deal in dealFlagged:
40
        print '\t',
40
        if not toScrapMap.has_key(deal['_id']):
41
        print y
41
            toScrapMap[deal['_id']] = deal
42
    pool = ThreadPool(cpu_count() *2)
42
    pool = ThreadPool(cpu_count() *2)
43
    pool.map(updatePrices,toScrapMap.values())
43
    pool.map(updatePrices,toScrapMap.values())
44
    pool.close()
44
    pool.close()
45
    pool.join()
45
    pool.join()
46
    print "joining threads"
46
    print "joining threads at %s"%(str(datetime.now()))
47
    print datetime.now()
-
 
48
 
47
 
49
 
48
 
50
def updatePrices(data):
49
def updatePrices(data):
51
    if data['source_id']!=3:
50
    if data['source_id']!=3:
52
        return
51
        return