예제 #1
0
파일: main.py 프로젝트: dropbox/grouper
def main(sys_argv=sys.argv):
    # type: (List[str]) -> None
    setup_signal_handlers()

    # get arguments
    parser = build_arg_parser("Grouper API Server")
    args = parser.parse_args(sys_argv[1:])

    try:
        # load settings
        settings = ApiSettings.global_settings_from_config(args.config)

        # setup logging
        setup_logging(args, settings.log_format)

        # setup sentry
        sentry_client = get_sentry_client(settings.sentry_dsn)
    except Exception:
        logging.exception("uncaught exception in startup")
        sys.exit(1)

    try:
        start_server(args, settings, sentry_client)
    except Exception:
        sentry_client.captureException()
    finally:
        logging.info("end")
예제 #2
0
파일: main.py 프로젝트: Warrelis/merou
def main(sys_argv=sys.argv):
    # type: (List[str]) -> None
    setup_signal_handlers()

    # get arguments
    parser = build_arg_parser("Grouper API Server")
    args = parser.parse_args(sys_argv[1:])

    try:
        # load settings
        settings = ApiSettings.global_settings_from_config(args.config)

        # setup logging
        setup_logging(args, settings.log_format)

        # setup sentry
        sentry_client = get_sentry_client(settings.sentry_dsn)
    except Exception:
        logging.exception("uncaught exception in startup")
        sys.exit(1)

    try:
        start_server(args, settings, sentry_client)
    except Exception:
        sentry_client.captureException()
    finally:
        logging.info("end")
예제 #3
0
파일: main.py 프로젝트: yasaswyk/merou
def main(sys_argv=sys.argv):
    # type: (List[str]) -> None
    setup_signal_handlers()

    # get arguments
    parser = build_arg_parser("Grouper API Server")
    args = parser.parse_args(sys_argv[1:])

    try:
        settings = ApiSettings.global_settings_from_config(args.config)
        setup_logging(args, settings.log_format)
        plugins = PluginProxy.load_plugins(settings, "grouper-api")
        set_global_plugin_proxy(plugins)
    except PluginsDirectoryDoesNotExist as e:
        logging.fatal("Plugin directory does not exist: %s", e)
        sys.exit(1)
    except Exception:
        logging.exception("Uncaught exception in startup")
        sys.exit(1)

    try:
        start_server(args, settings, plugins)
    except Exception:
        plugins.log_exception(None, None, *sys.exc_info())
        logging.exception("Uncaught exception")
    finally:
        logging.info("end")
예제 #4
0
def api_app(session, standard_graph):
    # type: (Session, GroupGraph) -> GrouperApplication
    settings = ApiSettings()
    set_global_settings(settings)
    session_factory = SingletonSessionFactory(session)
    usecase_factory = create_graph_usecase_factory(
        settings, PluginProxy([]), session_factory, standard_graph
    )
    return create_api_application(standard_graph, settings, usecase_factory)