Config Update
This commit is contained in:
@@ -108,6 +108,42 @@ class RunRecorder:
|
||||
# Gazebo window capture via xwd
|
||||
self._gazebo_wid = None
|
||||
self._find_gazebo_window()
|
||||
threading.Thread(target=self._upload_hardware_info, daemon=True).start()
|
||||
|
||||
def _upload_hardware_info(self):
|
||||
if not self.sim_id:
|
||||
return
|
||||
|
||||
payload = {
|
||||
"cpu_info": "Unknown CPU",
|
||||
"gpu_info": "Unknown GPU",
|
||||
"ram_info": "Unknown RAM"
|
||||
}
|
||||
|
||||
try:
|
||||
import subprocess
|
||||
cpu = "Unknown"
|
||||
try:
|
||||
cpu = subprocess.check_output("grep -m 1 'model name' /proc/cpuinfo | cut -d ':' -f 2", shell=True, timeout=2).decode('utf-8').strip()
|
||||
except Exception: pass
|
||||
if cpu: payload["cpu_info"] = cpu
|
||||
|
||||
try:
|
||||
ram_kb = int(subprocess.check_output("awk '/MemTotal/ {print $2}' /proc/meminfo", shell=True, timeout=2))
|
||||
payload["ram_info"] = f"{round(ram_kb / 1024 / 1024, 1)} GB"
|
||||
except Exception: pass
|
||||
|
||||
try:
|
||||
gpu = subprocess.check_output("lspci | grep -i vga | cut -d ':' -f 3", shell=True, timeout=2).decode('utf-8').strip()
|
||||
if gpu: payload["gpu_info"] = gpu
|
||||
except Exception: pass
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
requests.put(f"{API_URL}/api/simulations/{self.sim_id}/hardware", json=payload, timeout=5)
|
||||
except Exception as e:
|
||||
print(f"[REC] Hardware info sync failed: {e}")
|
||||
|
||||
def _upload_file(self, path, filename):
|
||||
if not self.sim_id:
|
||||
|
||||
Reference in New Issue
Block a user