1 Star 1 Fork 98

cimitom/JD-SHOPPER

forked from louisyoungx/jd-shopper 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
runserver.py 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
louisyoungx 提交于 2021-11-22 14:35 . feat(gui): package the gui file
from Core.core import main
from Logger.logger import logger
from Scheduler.scheduler import Timer
from Config.settings import config
from Server.server import server
from threading import Thread
from GUI.gui import gui
from concurrent.futures import ProcessPoolExecutor
PROCESS_MODEL = config.settings("Server", "PROCESS_MODEL")
SCHEDULER = config.settings("Scheduler", "START_USING")
SERVER = config.settings("Server", "START_USING")
GUI = config.settings("GUI", "START_USING")
def running():
if not SCHEDULER:
thread_main = Thread(target=main)
thread_main.start()
else: # 调度器开启后main函数将被scheduler调度器代理,开启定时执行main
startTime = config.settings("Scheduler", "START_TIME")
skipWeekend = config.settings("Scheduler", "SKIP_WEEKEND")
scheduler = Timer(task=main, startTime=startTime, skipWeekend=skipWeekend)
thread_scheduler = Thread(target=scheduler.schedule)
thread_scheduler.start()
if SERVER:
if PROCESS_MODEL:
work_count = config.settings("Server", "PROCESS_COUNT")
server_process(work_count)
else:
thread_server = Thread(target=server)
thread_server.start()
if GUI:
gui()
def server_process(work_count=4):
with ProcessPoolExecutor(work_count) as pool:
for i in range(work_count):
pool.submit(server())
if __name__ == "__main__":
DEBUG = config.settings("Debug", "DEBUG")
if DEBUG:
logger.info("\n===== DEBUG MODE =====")
main()
else:
running()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cimitom/JD-SHOPPER.git
[email protected]:cimitom/JD-SHOPPER.git
cimitom
JD-SHOPPER
JD-SHOPPER
master

搜索帮助