feat: add subprocess handling for local model and conditional post handler execution

This commit is contained in:
CaptainB 2025-11-04 14:00:12 +08:00
parent 89e7e7b805
commit e497ce271f
2 changed files with 6 additions and 3 deletions

View File

@ -36,7 +36,8 @@ class GunicornLocalModelService(BaseService):
'--max-requests-jitter', '2048',
'--access-logformat', log_format,
'--access-logfile', '/dev/null',
'--error-logfile', '-'
'--error-logfile', '-',
'-e', 'ENABLE_LOCAL_MODEL=1'
]
if DEBUG:
cmd.append('--reload')

View File

@ -30,8 +30,10 @@ def post_scheduler_handler():
job.run()
# 启动后处理函数
post_handler()
# 仅在非local_model模式下启动后处理函数dev celery scheduler 不需要
if os.environ.get("ENABLE_LOCAL_MODEL") != '1':
# 启动后处理函数
post_handler()
# 仅在scheduler中启动定时任务dev local_model celery 不需要
if os.environ.get('ENABLE_SCHEDULER') == '1':