diff --git a/src/controller/allocation_controller.py b/src/controller/allocation_controller.py index 89dc24f..365215a 100644 --- a/src/controller/allocation_controller.py +++ b/src/controller/allocation_controller.py @@ -4,7 +4,7 @@ Author: Zella Zhong Date: 2024-05-23 22:47:04 LastEditors: Zella Zhong -LastEditTime: 2024-05-24 05:20:48 +LastEditTime: 2024-05-24 05:44:35 FilePath: /id_allocation/src/controller/allocation_controller.py Description: allocation controller ''' @@ -67,7 +67,7 @@ def allocation(self): ssql = "SELECT * FROM process_id_allocation(%s, '%s', %d);" % (process_vids, graph_id, updated_nanosecond) cursor.execute(ssql) rows = [dict_factory(cursor, row) for row in cursor.fetchall()] - logging.debug("allocation vids: {}, result: {}".format(process_vids, rows)) + logging.info("allocation vids: {}, result: {}".format(process_vids, rows)) if len(rows) == 0: cursor.close() pg_conn.close() diff --git a/src/controller/hello_controller.py b/src/controller/hello_controller.py new file mode 100644 index 0000000..60de626 --- /dev/null +++ b/src/controller/hello_controller.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +''' +Author: Zella Zhong +Date: 2024-05-24 05:41:52 +LastEditors: Zella Zhong +LastEditTime: 2024-05-24 05:44:12 +FilePath: /id_allocation/src/controller/hello_controller.py +Description: +''' +from httpsvr import httpsvr + + +class HelloController(httpsvr.BaseController): + def __init__(self, obj, param=None): + super(HelloController, self).__init__(obj) + + def hello(self): + return httpsvr.Resp(msg="pong", data={}, code=0) diff --git a/src/data_server.py b/src/data_server.py index d2b4fea..68a5589 100644 --- a/src/data_server.py +++ b/src/data_server.py @@ -4,7 +4,7 @@ Author: Zella Zhong Date: 2024-05-23 22:34:52 LastEditors: Zella Zhong -LastEditTime: 2024-05-24 05:18:37 +LastEditTime: 2024-05-24 05:44:41 FilePath: /id_allocation/src/data_server.py Description: main entry point for allocating ''' @@ -14,6 +14,7 @@ import setting import setting.filelogger as logger +from controller.hello_controller import HelloController from controller.allocation_controller import AllocationController @@ -29,6 +30,7 @@ from httpsvr import httpsvr # [path, controller class, method] ctrl_info = [ + ["/", HelloController, "hello"], ["/id_allocation/allocation", AllocationController, "allocation"], ] svr = httpsvr.HttpSvr(config, ctrl_info) diff --git a/src/setting/filelogger.py b/src/setting/filelogger.py index 4638341..247e7d0 100644 --- a/src/setting/filelogger.py +++ b/src/setting/filelogger.py @@ -294,7 +294,7 @@ def InitLogger(config): logger.setLevel(static_file_handler.level) else: static_file_handler = FileHandler(config) - static_file_handler.setLevel(logging.DEBUG) + static_file_handler.setLevel(logging.INFO) static_file_handler.setPrintStd() static_file_handler.setFormatter(Formatter())