def _run_server(): host = cfg.CONF.stream.host port = cfg.CONF.stream.port LOG.info( "(PID=%s) ST2 Stream API is serving on http://%s:%s.", os.getpid(), host, port ) max_pool_size = eventlet.wsgi.DEFAULT_MAX_SIMULTANEOUS_REQUESTS worker_pool = eventlet.GreenPool(max_pool_size) sock = eventlet.listen((host, port)) def queue_shutdown(signal_number, stack_frame): eventlet.spawn_n( shutdown_server_kill_pending_requests, sock=sock, worker_pool=worker_pool, wait_time=WSGI_SERVER_REQUEST_SHUTDOWN_TIME, ) # We register a custom SIGINT handler which allows us to kill long running active requests. # Note: Eventually we will support draining (waiting for short-running requests), but we # will still want to kill long running stream requests. register_stream_signal_handlers(handler_func=queue_shutdown) wsgi.server(sock, app.setup_app(), custom_pool=worker_pool) return 0
def _run_server(): host = cfg.CONF.stream.host port = cfg.CONF.stream.port LOG.info('(PID=%s) ST2 Stream API is serving on http://%s:%s.', os.getpid(), host, port) max_pool_size = eventlet.wsgi.DEFAULT_MAX_SIMULTANEOUS_REQUESTS worker_pool = eventlet.GreenPool(max_pool_size) sock = eventlet.listen((host, port)) def queue_shutdown(signal_number, stack_frame): eventlet.spawn_n(shutdown_server_kill_pending_requests, sock=sock, worker_pool=worker_pool, wait_time=WSGI_SERVER_REQUEST_SHUTDOWN_TIME) # We register a custom SIGINT handler which allows us to kill long running active requests. # Note: Eventually we will support draining (waiting for short-running requests), but we # will still want to kill long running stream requests. register_stream_signal_handlers(handler_func=queue_shutdown) wsgi.server(sock, app.setup_app(), custom_pool=worker_pool) return 0
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os from st2stream import app config = { 'is_gunicorn': True, 'config_args': ['--config-file', os.environ.get('ST2_CONFIG_PATH', '/etc/st2/st2.conf')] } application = app.setup_app(config)
def setUpClass(cls): super(FunctionalTest, cls).setUpClass() tests_config.parse_args() cls.app = TestApp(app.setup_app())
# Copyright 2019 Extreme Networks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os from st2stream import app config = { 'is_gunicorn': True, 'config_args': ['--config-file', os.environ.get('ST2_CONFIG_PATH', '/etc/st2/st2.conf')] } application = app.setup_app(config)