兼容字符串格式的type

This commit is contained in:
RA
2023-03-22 00:17:50 +08:00
parent c1b569ff67
commit feac7d0e33

9
app.py
View File

@@ -6,6 +6,7 @@ from common import log
import os
from multiprocessing import Pool
def startProcess(channel_type):
# load config
config.load_config()
@@ -14,9 +15,11 @@ def startProcess(channel_type):
# startup channel
channel.startup()
def wrapper(channel_type):
startProcess(channel_type)
if __name__ == '__main__':
try:
# load config
@@ -29,10 +32,12 @@ if __name__ == '__main__':
model_type = config.conf().get("model").get("type")
channel_type = config.conf().get("channel").get("type")
if isinstance(channel_type, list) == False: # 兼容字符串格式的type
channel_type = [channel_type]
# 使用主进程启动终端通道
if "terminal" in channel_type:
index=channel_type.index("terminal")
index = channel_type.index("terminal")
terminal = channel_type.pop(index)
else:
terminal = None
@@ -50,4 +55,4 @@ if __name__ == '__main__':
pool.join()
except Exception as e:
log.error("App startup failed!")
log.exception(e)
log.exception(e)