Skip to content

Commit

Permalink
[#] add ctrl match /
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongFuze committed May 23, 2024
1 parent c1d714b commit ab83b29
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/controller/allocation_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
'''
Expand Down Expand Up @@ -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()
Expand Down
19 changes: 19 additions & 0 deletions src/controller/hello_controller.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 3 additions & 1 deletion src/data_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
'''
Expand All @@ -14,6 +14,7 @@
import setting
import setting.filelogger as logger

from controller.hello_controller import HelloController
from controller.allocation_controller import AllocationController


Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/setting/filelogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit ab83b29

Please sign in to comment.