fix(redis): cluster 模式 keys() 跨所有主分片 fan-out + 修 Dockerfile 漏拷 benchmark/(#44)
实测 heicode-rd(OSSCluster,2 分片):默认 keys() 只命中单节点, 漏掉其它分片上的 key → agent_registry/task_queue 枚举不全。 cluster 模式下改用 target_nodes=PRIMARIES,redis-py 合并各节点结果。 附带修 agent_swarm#44 Bug1:Dockerfile.orchestrator 漏 COPY benchmark/ (orchestrator/quality.py 启动即 import benchmark.fixtures/metrics)→ 原镜像 CrashLoopBackOff。新增 .dockerignore 控制构建上下文。 影响范围:仅 agent_swarm orchestrator(连接层 + 构建物料); 不改契约/计费/审计/密钥落地。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
35aab3a643
commit
2b0f2fe6f2
@@ -0,0 +1,9 @@
|
||||
.git
|
||||
**/__pycache__
|
||||
**/*.pyc
|
||||
*.md
|
||||
desktop-client
|
||||
test-data
|
||||
artifacts
|
||||
kind-config.yaml
|
||||
.github
|
||||
@@ -9,6 +9,10 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
# Copy orchestrator code
|
||||
COPY orchestrator/ ./orchestrator/
|
||||
|
||||
# orchestrator/quality.py imports benchmark.fixtures / benchmark.metrics at startup,
|
||||
# so the package must be present in the image (agent_swarm#44). stdlib-only — no extra pip.
|
||||
COPY benchmark/ ./benchmark/
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8000
|
||||
|
||||
|
||||
@@ -172,7 +172,16 @@ class RedisClient:
|
||||
await self.client.hdel(name, *keys)
|
||||
|
||||
async def keys(self, pattern: str) -> list:
|
||||
"""Get keys matching pattern."""
|
||||
"""Get keys matching pattern.
|
||||
|
||||
In cluster mode KEYS must fan out to every primary and merge — the default
|
||||
routing hits a single node, so on a multi-shard cluster it silently drops
|
||||
keys living on other shards (breaks agent/task enumeration). redis-py merges
|
||||
the per-node results into one flat list.
|
||||
"""
|
||||
if self.cluster:
|
||||
from redis.asyncio.cluster import RedisCluster
|
||||
return await self.client.keys(pattern, target_nodes=RedisCluster.PRIMARIES)
|
||||
return await self.client.keys(pattern)
|
||||
|
||||
async def lpush(self, key: str, *values: str):
|
||||
|
||||
Reference in New Issue
Block a user