コード例 #1
0
ファイル: cli.py プロジェクト: roofworrior/covid-data-model
def entry_point():
    """Basic entrypoint for cortex subcommands"""
    dataset_cache.set_pickle_cache_dir()
    sentry_sdk.init(os.getenv("SENTRY_DSN"))
    structlog.configure(
        processors=[
            structlog.stdlib.add_log_level,  # required before SentryProcessor()
            # sentry_sdk creates events for level >= ERROR and keeps level >= INFO as breadcrumbs.
            SentryProcessor(level=logging.INFO),
            structlog.processors.TimeStamper(fmt="iso"),
            structlog.dev.ConsoleRenderer(),
        ]
    )
コード例 #2
0
def entry_point(ctx):  # pylint: disable=no-value-for-parameter
    """Entry point for covid-data-model CLI."""
    common_init.configure_logging(command=ctx.invoked_subcommand)

    dataset_cache.set_pickle_cache_dir()
    pandarallel.initialize(progress_bar=False)
コード例 #3
0
        SentryProcessor(level=logging.INFO),
        structlog.processors.TimeStamper(fmt="iso"),
        structlog.dev.ConsoleRenderer(),
    ])


# adding the QA command
entry_point.add_command(compare_snapshots.compare_snapshots)

entry_point.add_command(run_top_counties_dataset.deploy_top_counties)
entry_point.add_command(run_counties_api.deploy_counties_api)
entry_point.add_command(run_states_api.deploy_states_api)
entry_point.add_command(api.main)
entry_point.add_command(utils.main)

# This code is executed when invoked as `python run.py ...` and will need to be changed if you
# want to add run.py to setup.py entry_points console_scripts. See
# https://github.com/pallets/click/issues/571#issuecomment-216261699
if __name__ == "__main__":
    sentry_sdk.init(os.getenv("SENTRY_DSN"))

    logging.basicConfig(level=logging.INFO)
    dataset_cache.set_pickle_cache_dir()
    pandarallel.initialize(progress_bar=False)
    try:
        entry_point()  # pylint: disable=no-value-for-parameter
    except Exception as e:
        # blanket catch exceptions at the entry point and send them to sentry
        sentry_sdk.capture_exception(e)
        raise e
コード例 #4
0
def entry_point():
    """Basic entrypoint for cortex subcommands"""
    dataset_cache.set_pickle_cache_dir()
    common_init.configure_logging()
コード例 #5
0
def set_timeseries_dataset_cache():
    # Forcing cache to use a new folder to always regenerate cache
    # during tests.
    dataset_cache.set_pickle_cache_dir(force=True)