Skip to content

Commit 8e3550e

Browse files
committed
feat: add subprocess handling for local model and conditional post handler execution
1 parent 065a443 commit 8e3550e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

apps/common/management/commands/services/services/local_model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def cmd(self):
3636
'--max-requests-jitter', '2048',
3737
'--access-logformat', log_format,
3838
'--access-logfile', '/dev/null',
39-
'--error-logfile', '-'
39+
'--error-logfile', '-',
40+
'-e', 'ENABLE_LOCAL_MODEL=1'
4041
]
4142
if DEBUG:
4243
cmd.append('--reload')

apps/maxkb/wsgi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ def post_scheduler_handler():
3030

3131
job.run()
3232

33-
# 启动后处理函数
34-
post_handler()
33+
# 仅在非local_model模式下启动后处理函数,dev celery scheduler 不需要
34+
if os.environ.get("ENABLE_LOCAL_MODEL") != '1':
35+
# 启动后处理函数
36+
post_handler()
3537

3638
# 仅在scheduler中启动定时任务,dev local_model celery 不需要
3739
if os.environ.get('ENABLE_SCHEDULER') == '1':

0 commit comments

Comments
 (0)