Esempio n. 1
0
def plotGoodInstances(outputDir):
    launchedJsonFilePath = outputDir + "/recruitLaunched.json"
    jlogFilePath = outputDir + "/batchRunner_results.jlog"

    launchedInstances = []
    with open(launchedJsonFilePath, 'r') as jsonInFile:
        try:
            launchedInstances = json.load(jsonInFile)  # an array
        except Exception as exc:
            logger.warning('could not load json (%s) %s', type(exc), exc)

    completedFrames = extractFrameInfo(jlogFilePath)
    logger.debug('found %d frames', len(completedFrames))

    goodIids = set([frame['instanceId'] for frame in completedFrames])
    goodInstances = [
        inst for inst in launchedInstances if inst['instanceId'] in goodIids
    ]

    plotInstanceMap.plotInstanceMap(goodInstances, outputDir + "/worldMap.png")
    plotInstanceMap.plotInstanceMap(goodInstances, outputDir + "/worldMap.svg")
Esempio n. 2
0
        print(launchedInstances[0]["device-location"]["latitude"])
        print(launchedInstances[0]["device-location"]["longitude"])
        print(launchedInstances[0]["device-location"]["display-name"])
        print(launchedInstances[0]["device-location"]["country"])

    completedJobs = demuxResults(jlogFilePath)

    goodIids = set([job[1] for job in completedJobs])
    logger.debug('goodIids: %s', goodIids)
    goodInstances = [
        inst for inst in launchedInstances if inst['instanceId'] in goodIids
    ]
    logger.debug('%d goodInstances', len(goodInstances))

    if plotInstanceMap:
        plotInstanceMap.plotInstanceMap(goodInstances,
                                        outputDir + "/worldMap.png")
        plotInstanceMap.plotInstanceMap(goodInstances,
                                        outputDir + "/worldMap.svg")

    mappedFrameNumLocation = []
    mappedFrameNumLocationUnitedStates = []
    mappedFrameNumLocationRussia = []
    mappedFrameNumLocationOther = []

    for i in range(0, len(completedJobs)):
        for j in range(0, len(launchedInstances)):
            if launchedInstances[j]["instanceId"] == completedJobs[i][1]:
                mappedFrameNumLocation.append([
                    completedJobs[i][0],
                    launchedInstances[j]["device-location"]["latitude"],
                    launchedInstances[j]["device-location"]["longitude"],