예제 #1
0
def main():
    counter = 0

    # make sure output dir exists
    try:
        if not conf.JSON_OUTPUT_DIR.exists():
            conf.JSON_OUTPUT_DIR.mkdir(parents=True)
    except OSError:
        log.exception('Can not create output dir: {}'.format(conf.JSON_OUTPUT_DIR))
        return 1

    while True:
        if KILLED:
            log.info('Shutdown successful')
            return 0

        for timestamp in get_timestamps_to_process():
            write_json_for_timestamp(timestamp)
            redis.zrem(rkeys.MAP_TIMESTAMPS, timestamp)
            map_geo_key = rkeys.MAP_GEO.format(timestamp)
            redis.delete(map_geo_key)

        # don't run constantly since we'll only have something
        # to do every ~1 minute
        counter += 1
        time.sleep(10)
예제 #2
0
def main():
    counter = 0

    while True:
        if KILLED:
            log.info('Shutdown successful')
            return 0

        for timestamp in get_timestamps_to_process():
            write_json_for_timestamp(timestamp)
            redis.zrem(rkeys.MAP_TIMESTAMPS, timestamp)
            map_geo_key = rkeys.MAP_GEO.format(timestamp)
            redis.delete(map_geo_key)

        # don't run constantly since we'll only have something
        # to do every ~1 minute
        counter += 1
        time.sleep(10)