Download scripts/helpers/common/audit_executor.py from Dawn9705/olmes-qwen3-base-code-reference: direct link, hf CLI and curl.
- Browser
- Download file 1.59 kB
-
https://huggingface.co/datasets/Dawn9705/olmes-qwen3-base-code-reference/resolve/main/scripts/helpers/common/audit_executor.py
- Command line
-
hf download hf://datasets/Dawn9705/olmes-qwen3-base-code-reference/scripts/helpers/common/audit_executor.py
-
curl -L -o audit_executor.py https://huggingface.co/datasets/Dawn9705/olmes-qwen3-base-code-reference/resolve/main/scripts/helpers/common/audit_executor.py
1.59 kB
| #!/usr/bin/env python3 | |
| """Record remote executor anomalies without automatically invalidating scores.""" | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import re | |
| from pathlib import Path | |
| PATTERNS = { | |
| "connection_refused": re.compile(r"Connection refused"), | |
| "ssh_banner_error": re.compile(r"Error reading SSH protocol banner"), | |
| "connection_reset": re.compile(r"Connection reset by peer"), | |
| "executor_timeout": re.compile(r"(?:executor|Docker).*tim(?:ed|e) out", re.I), | |
| "docker_invocation_exception": re.compile(r"Exception when calling Docker container"), | |
| } | |
| def main() -> None: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("output", type=Path) | |
| parser.add_argument("log", type=Path) | |
| parser.add_argument("group", choices=("other", "ds1000")) | |
| args = parser.parse_args() | |
| text = args.log.read_text(encoding="utf-8", errors="replace") | |
| issues = {name: len(pattern.findall(text)) for name, pattern in PATTERNS.items()} | |
| issues = {name: count for name, count in issues.items() if count} | |
| payload = { | |
| "group": args.group, | |
| "output_dir": str(args.output), | |
| "executor_issues": issues, | |
| "total_executor_issues": sum(issues.values()), | |
| } | |
| target = args.output / "executor_audit.json" | |
| target.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8") | |
| if issues: | |
| print(f"WARNING: executor 异常已记录,不自动判失败:{issues}") | |
| else: | |
| print("未检测到 executor 异常。") | |
| if __name__ == "__main__": | |
| main() | |