Пример #1
0
    def test_load_default_config(self):
        app = unittest.mock.Mock()

        # unset EVENTLOG_SETTINGS
        del os.environ['EVENTLOG_SETTINGS']
        init_config(app)

        app.config.from_pyfile.assert_called_with(DEFAULT_CONFIG_FILE)
Пример #2
0
def main():
    init_config(app)

    init_options()
    init_logging()

    _LOG.info('starting processing')
    start = time.time()

    try:
        _LOG.debug('initializing store')
        store.init_app(app)
        _LOG.debug('store initialized')

        feeds = store.get_feeds(is_updating=True)

        update_feeds(feeds)

    except Exception:
        _LOG.critical('uncaught exception', exc_info=1)

    end = time.time()
    _LOG.info('finished processing (elapsed: %.6fs)', end - start)
Пример #3
0
    handler.setLevel(logging.INFO)
    handler.setFormatter(
        logging.Formatter(('[%(asctime)s.%(msecs)03d]: '
                           '%(levelname)10s | %(name)20s | %(message)s'),
                          '%H:%M:%S'))

    l = logging.getLogger()
    l.addHandler(handler)
    l.setLevel(logging.INFO)


if __name__ == "__main__":
    init_logging()

    app = Flask(__name__)
    init_config(app)
    store.init_app(app)

    args = docopt.docopt(__doc__)

    start = time.time()

    feeds = store.get_feeds()

    # get events
    es = store.get_events_by_timerange(flattened=True)

    batch = []

    for e in es:
        if e.archived is not None: