def setup_kws_server(self): """ sets up the KWS server to run on a separate port """ # based on http://docs.cherrypy.org/stable/refman/process/servers.html if not self.config['keyword_search']['kws_service_on']: return # load KWSWebService here since it will be loaded after self.configure # which brings secmodv2 into cherrypy.tools from DAS.web.kws_web_srv import KWSWebService kws_service = KWSWebService(self.config) kws_wsgi_app = _cptree.Tree() kws_wsgi_app.mount(kws_service, '/das') config = self.config['web_server'] port = int(config.get("kws_port", 8214)) host = config.get("kws_host", '0.0.0.0') if CherryPyWSGIServer: kws_server = CherryPyWSGIServer( bind_addr=(host, port), wsgi_app=kws_wsgi_app, numthreads=int(config.get("thread_pool_kws", 10)), request_queue_size=cpconfig["server.socket_queue_size"], # below are cherrypy default settings... # max=-1, # timeout=10, # shutdown_timeout=5 ) srv_adapter = ServerAdapter(engine, kws_server) srv_adapter.subscribe()
These API's are described in the CherryPy specification: http://www.cherrypy.org/wiki/CherryPySpec """ __version__ = '3.2.0' from cherrypy._cpcompat import urljoin as _urljoin, urlencode as _urlencode from cherrypy._cpcompat import basestring, unicodestr from cherrypy._cperror import HTTPError, HTTPRedirect, InternalRedirect from cherrypy._cperror import NotFound, CherryPyException, TimeoutError from cherrypy import _cpdispatch as dispatch from cherrypy import _cptools tools = _cptools.default_toolbox Tool = _cptools.Tool from cherrypy import _cprequest from cherrypy.lib import httputil as _httputil from cherrypy import _cptree tree = _cptree.Tree() from cherrypy._cptree import Application from cherrypy import _cpwsgi as wsgi from cherrypy import process try: from cherrypy.process import win32 engine = win32.Win32Bus() engine.console_control_handler = win32.ConsoleCtrlHandler(engine) del win32 except ImportError: engine = process.bus class _TimeoutMonitor(process.plugins.Monitor): def __init__(self, bus): self.servings = []