| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- # -*- coding: utf-8 -*-
- """运行时业务路径配置(向后兼容 re-export 层)。
- Phase 1 重构后真实配置在 config/*.yaml,经 infra/config.py 读取。
- 本文件保留所有原变量名,保证 run_web_server / run_preprocess_server /
- run_model_server / run_utils 等老代码无需改动即可运行。
- 重要变更:
- - PREPROCESS_QUEUE 拼写已修正为 "preprocess_queue1",
- 旧名 "preprocess_queqe1" 保留为 PREPROCESS_QUEUE_LEGACY_ALIAS,
- 兼容存量队列数据,将在下个版本删除。
- - 真实 Redis/PG 密码、IP 不再硬编码于此,走环境变量 / config/.env。
- 详见 ARCHITECTURE.md 第 11 章 Phase 1。
- """
- from __future__ import absolute_import
- import logging
- from BiddingKG.dl.infra import config as _config
- # ===== Redis 连接参数(原 settings.py 顶部)=====
- _main = _config.redis_main_config()
- REDIS_HOST = _main.get("host", "127.0.0.1")
- REDIS_PORT = int(_main.get("port", 6379))
- REDIS_DB = int(_main.get("db", 12))
- REDIS_PASS = _main.get("password", "")
- # ===== Redis 队列名 =====
- _q = _config.redis_queue_names()
- CONTENT_QUEUE = _q.get("content", "content_queue1")
- PREPROCESS_QUEUE = _q.get("preprocess", "preprocess_queue1") # 修正拼写
- PREPROCESS_QUEUE_LEGACY_ALIAS = _q.get("preprocess_legacy_alias", "preprocess_queqe1") # 兼容旧名
- ERROR_QUEUE = _q.get("error", "error_queue")
- TIMEOUT_QUEUE = _q.get("timeout", "timeout_queue")
- # ===== 消费者参数 =====
- _c = _config.redis_consumer_params()
- BATCH_SIZE = int(_c.get("batch_size", 2))
- SERVER_SLEEP = float(_c.get("server_sleep", 0.002))
- CLIENT_SLEEP = float(_c.get("client_sleep", 0.002))
- TIME_OUT = int(_c.get("timeout", 20))
- # ===== 日志配置 =====
- _log = _config.logging_settings()
- LOG_FORMAT = _log.get("format", "%(asctime)s - %(levelname)s - %(message)s")
- DATE_FORMAT = _log.get("date_format", "%m/%d/%Y %H:%M:%S %p")
- _level_name = str(_log.get("level", "INFO")).upper()
- LOG_LEVEL = getattr(logging, _level_name, logging.INFO)
- LOG_FILE = _log.get("file", "logs/model_server.log")
- # ===== 模型输入 shape =====
- MODEL_ROLE_INPUT_SHAPE = _config.model_input_shape("role")
- MODEL_MONEY_INPUT_SHAPE = _config.model_input_shape("money")
- MODEL_PERSON_INPUT_SHAPE = _config.model_input_shape("person")
|