39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Synthetic fixture. No GPU, network, model calls or existing data access."""
|
|
import json
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
|
|
|
|
def main():
|
|
mode, run_id, destination = sys.argv[1:]
|
|
folder = Path(destination)
|
|
print("SYNTHETIC FLOW ACCEPTANCE: not a model benchmark", flush=True)
|
|
if mode == "wait":
|
|
child = subprocess.Popen([sys.executable, "-c", "import time; time.sleep(60)"])
|
|
(folder / "child.pid").write_text(str(child.pid), encoding="utf-8")
|
|
print(f"waiting; controlled_child_pid={child.pid}", flush=True)
|
|
child.wait(timeout=65)
|
|
return 0
|
|
if mode == "failure":
|
|
print("Expected fixture failure", flush=True)
|
|
return 23
|
|
if mode == "invalid-report":
|
|
(folder / "result.json").write_text('{"incomplete":true}', encoding="utf-8")
|
|
return 0
|
|
if mode != "success":
|
|
return 2
|
|
for step in range(1, 4):
|
|
print(f"progress={step}/3", flush=True)
|
|
time.sleep(.2)
|
|
(folder / "result.json").write_text(json.dumps({
|
|
"run_id": run_id, "synthetic": True, "checks_passed": 3,
|
|
"description": "Synthetic flow acceptance only"}), encoding="utf-8")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|