Пример #1
0
def main():
    _shutdown.handle_signals()

    config.config_and_logging(sys.argv)
    log = oslo_log.getLogger("deepaas")

    if CONF.openwhisk_detect and os.environ.get('__OW_API_HOST', None):
        log.info("Starting DEEPaaS (OpenWhisk) version %s",
                 deepaas.__version__)

        proxy.main()
    else:
        base = "http://{}:{}".format(CONF.listen_ip, CONF.listen_port)
        spec = "{}/swagger.json".format(base)
        docs = "{}/ui".format(base)
        v2 = "{}/v2".format(base)

        print(INTRO)
        print(BANNER.format(docs, spec, v2))

        log.info("Starting DEEPaaS version %s", deepaas.__version__)

        app = api.get_app(doc="/ui")
        web.run_app(
            app,
            host=CONF.listen_ip,
            port=CONF.listen_port,
        )
Пример #2
0
def init():
    global APP

    try:
        if APP is None:
            APP = api.get_app(doc=False)
        return ('OK', 200)
    except Exception as e:
        response = flask.jsonify({'error': 'Internal error. {}'.format(e)})
        response.status_code = 500
        return complete(response)
Пример #3
0
def main():
    _shutdown.handle_signals()
    config.parse_args(sys.argv)
    logging.setup(CONF, "deepaas")
    log = logging.getLogger(__name__)

    if CONF.openwhisk_detect and os.environ.get('__OW_API_HOST', None):
        log.info("Starting DEEPaaS (OpenWhisk) version %s",
                 deepaas.__version__)

        proxy.main()
    else:
        log.info("Starting DEEPaaS version %s", deepaas.__version__)

        app = api.get_app()
        app.run(
            host=CONF.listen_ip,
            port=CONF.listen_port,
            debug=CONF.debug,
        )
Пример #4
0
 def test_get_app(self, mock_app):
     self.assertEqual(mock_app, api.get_app())