Files
troupe-standup/wizard-work/spark/metrics_report.py
T

41 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python3
"""
Spark's System Metrics Reporter - A verifiable micro-task artifact.
Generates a JSON report with system metrics.
"""
import json
import os
import platform
import sys
from datetime import datetime
def get_system_metrics():
"""Gather system metrics into a dictionary."""
return {
"timestamp": datetime.utcnow().isoformat() + "Z",
"hostname": platform.node(),
"python_version": platform.python_version(),
"python_implementation": platform.python_implementation(),
"os": platform.system(),
"os_version": platform.release(),
"architecture": platform.machine(),
"working_directory": os.getcwd(),
"script_path": "/root/.hermes/wizard-outputs/spark/metrics_report.py",
"exit_code": 0,
"verified": True
}
def main():
metrics = get_system_metrics()
output_path = "/root/.hermes/wizard-outputs/spark/system_metrics.json"
with open(output_path, 'w') as f:
json.dump(metrics, f, indent=2)
print(f"Metrics written to {output_path}")
print(json.dumps(metrics, indent=2))
return 0
if __name__ == "__main__":
sys.exit(main())