def runAndStorePerformanceTest(self, gamedayGameURLs):
        beforeSeconds = time.time()
        
        for gameURL in gamedayGameURLs:
            xmlProvider = GamedayXMLProvider(gameURL)
        
            gameStatsWorkList = GameStatsWorkList()
        
            gameLoader = GamedayGameLoader(self.db, xmlProvider, gameStatsWorkList)
        
            gameLoader.delete()
        
            gameLoader.loadGame()
        
            gameLoader.delete()
        
        totalSeconds = time.time() - beforeSeconds
        timeHere = time.localtime()
        readableTime = time.asctime(timeHere)
        
        performanceTrackingFileContents = fileUtils.slurp(self.performanceFileName)
        
        performanceResult = "\n" + readableTime + "," + str(totalSeconds) + "," + str(len(gamedayGameURLs))
        
        performanceTrackingFileContents.append(performanceResult)
        
        fileUtils.spit(self.performanceFileName, performanceTrackingFileContents)
              

        
        
Beispiel #2
0
    def testLoad_2009_04_12(self):
        gamedayDirectory = GamedayDirectoryStructure(
            GamedayConfig.mlbGamedayApplicationURL, "mlb")

        gamedayGameURLs = gamedayDirectory.getGameURLsForDay(
            ("2009", "04", "12"))

        for gameURL in gamedayGameURLs:
            xmlProvider = GamedayXMLProvider(gameURL)

            gameStatsWorkList = GameStatsWorkList()

            gameLoader = GamedayGameLoader(self.db, xmlProvider,
                                           gameStatsWorkList)

            if gameLoader.isAlreadyLoaded():
                gameLoader.delete()

            logging.info("loading:" + xmlProvider.getGameName())

            gameLoader.loadGame()

            loaded = gameLoader.isAlreadyLoaded()

            self.assertTrue(loaded)

        logging.info("")
        logging.info("load complete!")
Beispiel #3
0
def main():

    options = commandLineOptionsParser.parseDeleteOptions()

    logging.info("Starting delete!")

    league = options.league

    gamedayDirectory = GamedayDirectoryStructure(BBOSConfig.gamedayURL, league)

    if not options.game:
        logging.error(
            "delete only accepts league and -g gameName as parameters")

    gamedayGameURLs = gamedayDirectory.getGameURLsForGame(options.game)

    xmlProvider = GamedayXMLProvider(gamedayGameURLs[0])

    db = DB()

    gameStatsWorkList = GameStatsWorkList()

    gameLoader = GamedayGameLoader(db, xmlProvider, gameStatsWorkList)

    gameLoader.delete()

    logging.info("")
    logging.info("delete complete!")
Beispiel #4
0
    def consume(self, item):
        gameURL = item

        xmlProvider = GamedayXMLProvider(gameURL)

        gameStatsWorkList = GameStatsWorkList()

        gameLoader = GamedayGameLoader(self.db, xmlProvider, gameStatsWorkList)

        if not gameLoader.isAlreadyLoaded():
            logging.info("loading:" + xmlProvider.getGameName())

            gameLoader.loadGame()
        else:
            logging.info("skipping previously loaded:" +
                         xmlProvider.getGameName())
    def testLoad(self):
        url = "http://gd2.mlb.com/components/game/mlb/year_2006/month_06/day_08/gid_2006_06_08_tormlb_balmlb_1/"
        
        xmlProvider = GamedayXMLProvider(url)
        
        gameStatsWorkList = GameStatsWorkList()
        
        gameLoader = GamedayGameLoader(self.db, xmlProvider, gameStatsWorkList)
        
        gameLoader.delete()
        
        gameLoader.loadGame()
        
        loaded = gameLoader.isAlreadyLoaded()
        
        self.assertTrue(loaded)      
                   
    
           
              

        
        
    def setUp(self):
        self.db = DB()

        self.gameStatsWorkList = GameStatsWorkList()