from tabpy_client.query_object import QueryObject from common.util import format_exception from common.messages import * from common.tabpy_logging import ( PYLogging, log_error, log_info, log_debug, log_warning, ) import logging logging.basicConfig(level=logging.ERROR) logger = logging.getLogger(__name__) PYLogging.initialize(logger) if sys.version_info.major == 3: unicode = str class PythonServiceHandler: """ A wrapper around PythonService object that receives requests and calls the corresponding methods. """ def __init__(self, ps): self.ps = ps def manage_request(self, msg): try: log_info("Received request", request_type=type(msg).__name__)
from psws.python_service import PythonService from psws.python_service import PythonServiceHandler from common.util import format_exception from common.tabpy_logging import PYLogging, log_error, log_info, log_debug from common.messages import Query, QuerySuccessful, QueryError, UnknownURI from psws.callbacks import (init_ps_server, init_model_evaluator, on_state_change) from management.util import _get_state_from_file from management.state import TabPyState, get_query_object_path import concurrent.futures logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) PYLogging.initialize(logger) STAGING_THREAD = concurrent.futures.ThreadPoolExecutor(max_workers=3) _QUERY_OBJECT_STAGING_FOLDER = 'staging' if sys.version_info.major == 3: unicode = str def parse_arguments(): ''' Parse input arguments and return the parsed arguments. Expected arguments: * --port : int ''' parser = ArgumentParser(description='Run Python27 Service.') parser.add_argument('--port',