34 lines
822 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
队列启动入口:读取 Config 并以 exec 方式启动 Dramatiq CLI。
开发与生产均使用该单一角色入口,由外层脚本/编排并行管理。
"""
import os
from jingrow.config import Config
from jingrow.utils.path import get_apps_path
def main() -> None:
processes = int(getattr(Config, "worker_processes", 1))
threads = int(getattr(Config, "worker_threads", 1))
args = [
"dramatiq",
"jingrow.services.queue",
"--processes",
str(processes),
"--threads",
str(threads),
]
# 仅从 Config.watch 控制是否启用 watch目录固定为 apps 根目录
if bool(getattr(Config, "watch", False)):
args.extend(["--watch", str(get_apps_path())])
os.execvp("dramatiq", args)
if __name__ == "__main__":
main()