dramatiq增加watch支持热重载,默认监控apps目录
This commit is contained in:
parent
8b25b8ccec
commit
6c344f776f
@ -46,6 +46,7 @@ class Settings(BaseSettings):
|
||||
# 异步任务队列(Dramatiq)配置
|
||||
worker_processes: int = 1
|
||||
worker_threads: int = 1
|
||||
watch: bool = True
|
||||
|
||||
class Config:
|
||||
env_file = str(Path(__file__).resolve().parents[3] / '.env')
|
||||
|
||||
@ -20,6 +20,11 @@ def main() -> None:
|
||||
"--threads",
|
||||
str(threads),
|
||||
]
|
||||
# 仅从 Config.watch 控制是否启用 watch,目录固定为 apps 根目录
|
||||
if bool(getattr(Config, "watch", False)):
|
||||
current_dir = os.path.dirname(__file__)
|
||||
apps_dir = os.path.abspath(os.path.join(current_dir, "..", ".."))
|
||||
args.extend(["--watch", apps_dir])
|
||||
os.execvp("dramatiq", args)
|
||||
|
||||
|
||||
|
||||
@ -9,4 +9,6 @@ dependencies = [
|
||||
"pydantic-settings>=2.0.0",
|
||||
"qdrant-client==1.15.1",
|
||||
"requests==2.31.0",
|
||||
"dramatiq",
|
||||
"dramatiq[watch]",
|
||||
]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jingrow",
|
||||
"version": "1.0.0",
|
||||
"description": "AI Agent工作流平台",
|
||||
"description": "AI Agent Framework",
|
||||
"scripts": {
|
||||
"dev": "./dev.sh start",
|
||||
"stop": "./dev.sh stop",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user