import json
import shutil
import sys
from pathlib import Path
if len(sys.argv) != 7:
msg = f"bad inputs in postprocess.py: {sys.argv}"
raise Exception(msg)
print(f"running {sys.argv}")
assert shutil.which("nvidia-smi") is not None
input_file1 = Path(sys.argv[2])
input_file2 = Path(sys.argv[4])
output_file = Path(sys.argv[6])
if not input_file1.exists():
msg = f"{input_file1} does not exist"
raise Exception(msg)
if not input_file2.exists():
msg = f"{input_file2} does not exist"
raise Exception(msg)
output_file.write_text(json.dumps({"hello": "world"}, indent=2) + "\n", encoding="utf-8")