[COMBINE] Support-очередь разделена: PC 9123 / host 9224, инструкция PC-воркера
This commit is contained in:
1 parent
a1cca55603
commit
48d4cc8aa0
2 files changed
+69
No files matched your search
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Разделить support-очередь на host/PC шарды (по hash URL)."""
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
|
||||
OUT = "/opt/work-hub/research"
|
||||
src = os.path.join(OUT, "queue-retry-support.jsonl")
|
||||
rows = [json.loads(l) for l in open(src, encoding="utf-8") if l.strip()]
|
||||
pc, host = [], []
|
||||
for x in rows:
|
||||
h = int(hashlib.sha1(x["url"].encode()).hexdigest(), 16)
|
||||
(pc if h % 2 == 0 else host).append(x)
|
||||
for name, data in (("queue-support-pc.jsonl", pc), ("queue-support-host.jsonl", host)):
|
||||
with open(os.path.join(OUT, name), "w", encoding="utf-8") as f:
|
||||
for x in data:
|
||||
f.write(json.dumps(x, ensure_ascii=False) + "\n")
|
||||
print("pc", len(pc), "host", len(host), "total", len(rows))
|
||||
Reference in new issue
Block a user