def serve(): conf = config.get_global() # Enable logging configuration if conf.get('SET_LOGGING', True): set_logger() server_interceptor = _ServerInterceptor() server = grpc.server( futures.ThreadPoolExecutor(max_workers=conf['MAX_WORKERS']), interceptors=(server_interceptor,), # options=_get_grpc_options(conf) ) server, service_names = _init_services(server) service_names_str = '\n\t - '.join(service_names) _LOGGER.debug(f'Loaded Services: \n\t - {service_names_str}') reflection.enable_server_reflection(service_names, server) server.add_insecure_port(f'[::]:{conf["PORT"]}') _LOGGER.info(f'Start gRPC Server ({config.get_service()}): ' f'port={conf["PORT"]}, max_workers={conf["MAX_WORKERS"]}') server.start() server.wait_for_termination()
def __init__(self, metadata: dict = {}, transaction: Transaction = None, **kwargs): self.func_name = None self.is_with_statement = False if transaction: self.transaction = transaction else: self.transaction = Transaction(metadata) if config.get_global('SET_LOGGING', True): set_logger(transaction=self.transaction) self.locator = Locator(self.transaction) self.handler = { 'authentication': { 'handlers': [], 'methods': [] }, 'authorization': { 'handlers': [], 'methods': [] }, 'mutation': { 'handlers': [], 'methods': [] }, 'event': { 'handlers': [], 'methods': [] }, }
def serve(): # Load scheduler config # Create Scheduler threads # start Scheduler set_logger() conf = config.get_global() server = Server(config.get_service(), conf) server.start()
def serve(): # Load scheduler config # Create Scheduler threads # start Scheduler conf = config.get_global() # Enable logging configuration if conf.get('SET_LOGGING', True): set_logger() server = Server(config.get_service(), conf) server.start()
def serve(): conf = config.get_global() # Enable logging configuration if conf.get('SET_LOGGING', True): set_logger() _LOGGER.info(f'Start REST Server ({config.get_service()}): ' f'host={conf["HOST"]} port={conf["PORT"]}') uvicorn.run('spaceone.core.fastapi.server:api_app', host=conf['HOST'], port=conf['PORT'], factory=True)
def __init__(self, metadata={}, transaction=None): self.func_name = None self.is_with_statement = False if transaction: self.transaction = transaction else: self.transaction = Transaction(metadata) set_logger(transaction=self.transaction) self.locator = Locator(self.transaction) self.handler = { 'authentication': {'handlers': [], 'methods': []}, 'authorization': {'handlers': [], 'methods': []}, 'event': {'handlers': [], 'methods': []}, }
def __init__(self, *args, **kwargs): transaction = Transaction() set_logger(transaction) self.locator = Locator(transaction)
def setup_logging(**kwargs): if config.get_global('CELERY', {}).get('mode') == 'BEAT': set_logger() else: set_logger(transaction=Transaction())