coarena autoreg: multikey farm + rotator shim
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
# Wave over gmail_bank.jsonl: python coa_wave.py <N> <WORKERS>
|
||||
# Resume is by idx from keys_bank.jsonl / keys_fail.jsonl; >3 workers = Chrome fights itself.
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
BASE = os.environ.get("COA_HOME", "C:/Users/User/tmp/coarena")
|
||||
PY = os.environ.get("COA_PY", r"C:/Users/User/AppData/Local/Programs/Python/Python311/python.exe")
|
||||
env = dict(os.environ)
|
||||
env.pop("PYTHONPATH", None)
|
||||
env["PYTHONIOENCODING"] = "utf-8"
|
||||
|
||||
|
||||
def run_one(idx):
|
||||
try:
|
||||
r = subprocess.run([PY, BASE + "/coa_one.py", str(idx)], cwd=BASE, env=env,
|
||||
timeout=420, capture_output=True, text=True)
|
||||
return idx, r.returncode, (r.stderr or "")[-160:]
|
||||
except Exception as e:
|
||||
return idx, -1, str(e)[:160]
|
||||
|
||||
|
||||
def main():
|
||||
total = int(sys.argv[1]) if len(sys.argv) > 1 else 50
|
||||
workers = int(sys.argv[2]) if len(sys.argv) > 2 else 3
|
||||
done = set()
|
||||
for f in ("keys_bank.jsonl", "keys_fail.jsonl"):
|
||||
p = os.path.join(BASE, f)
|
||||
if os.path.exists(p):
|
||||
for line in open(p, encoding="utf8"):
|
||||
try:
|
||||
done.add(json.loads(line)["idx"])
|
||||
except Exception:
|
||||
pass
|
||||
with ThreadPoolExecutor(workers) as ex:
|
||||
for idx, rc, err in ex.map(run_one, [i for i in range(total) if i not in done]):
|
||||
print("idx=%d rc=%d %s" % (idx, rc, err.strip()[:80]), flush=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user