Subversion Repositories SmartDukaan

Rev

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

Rev 12211 Rev 12213
Line 2121... Line 2121...
2121
#    finally:
2121
#    finally:
2122
#        r={}
2122
#        r={}
2123
#    
2123
#    
2124
    val.ourFlipkartInventory = 0
2124
    val.ourFlipkartInventory = 0
2125
            
2125
            
2126
def threadsToSpawn(runType,itemInfo,scraper,itemPopulated):
2126
def threadsToSpawn(runType,itemInfo,itemPopulated):
2127
    if runType == RunType.FAVOURITE:
2127
    if runType == RunType.FAVOURITE:
2128
        count = 0
2128
        count = 0
2129
        pool = ThreadPool(3)
2129
        pool = ThreadPool(3)
2130
        startOffset = 0
2130
        startOffset = 0
2131
        endOffset = startOffset
2131
        endOffset = startOffset
Line 2649... Line 2649...
2649
    timestamp = datetime.now()
2649
    timestamp = datetime.now()
2650
    previousProcessingTimestamp = session.query(func.max(MarketPlaceHistory.timestamp)).filter(MarketPlaceHistory.source==OrderSource.FLIPKART).one()
2650
    previousProcessingTimestamp = session.query(func.max(MarketPlaceHistory.timestamp)).filter(MarketPlaceHistory.source==OrderSource.FLIPKART).one()
2651
    itemInfo= populateStuff(options.runType,timestamp)
2651
    itemInfo= populateStuff(options.runType,timestamp)
2652
    itemsPopulated = 0
2652
    itemsPopulated = 0
2653
    while (len(itemInfo)>0):
2653
    while (len(itemInfo)>0):
2654
        itemsPopulated = threadsToSpawn(options.runType,itemInfo,scraper,itemsPopulated)
2654
        itemsPopulated = threadsToSpawn(options.runType,itemInfo,itemsPopulated)
2655
        cantCompete, buyBoxItems, competitive, competitiveNoInventory, exceptionItems, negativeMargin, cheapButNotPref, prefButNotCheap = decideCategory(itemInfo[0:itemsPopulated])
2655
        cantCompete, buyBoxItems, competitive, competitiveNoInventory, exceptionItems, negativeMargin, cheapButNotPref, prefButNotCheap = decideCategory(itemInfo[0:itemsPopulated])
2656
        itemInfo[0:itemsPopulated] = []
2656
        itemInfo[0:itemsPopulated] = []
2657
        commitExceptionList(exceptionItems,timestamp)
2657
        commitExceptionList(exceptionItems,timestamp)
2658
        commitCantCompete(cantCompete,timestamp)
2658
        commitCantCompete(cantCompete,timestamp)
2659
        commitBuyBox(buyBoxItems,timestamp)
2659
        commitBuyBox(buyBoxItems,timestamp)