MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / show_info

Method show_info

vmm/src/vmm-cli.py:1178–1222  ·  view source on GitHub ↗

Show detailed information about a VM.

(self, vm_id: str, json_output: bool = False)

Source from the content-addressed store, hash-verified

1176 print(f"No updates specified for VM {vm_id}")
1177
1178 def show_info(self, vm_id: str, json_output: bool = False) -> None:
1179 """Show detailed information about a VM."""
1180 response = self.rpc_call("GetInfo", {"id": vm_id})
1181
1182 if not response.get("found", False) or "info" not in response:
1183 print(f"VM with ID {vm_id} not found")
1184 return
1185
1186 info = response["info"]
1187
1188 if json_output:
1189 print(json.dumps(info, indent=2))
1190 return
1191
1192 config = info.get("configuration", {})
1193
1194 print(f"VM ID: {info.get('id', '-')}")
1195 print(f"Name: {info.get('name', '-')}")
1196 print(f"Status: {info.get('status', '-')}")
1197 print(f"Uptime: {info.get('uptime', '-')}")
1198 print(f"App ID: {info.get('app_id', '-')}")
1199 print(f"Instance ID: {info.get('instance_id', '-') or '-'}")
1200 print(f"App URL: {info.get('app_url', '-') or '-'}")
1201 print(f"Image: {config.get('image', '-')}")
1202 print(f"Image Version: {info.get('image_version', '-')}")
1203 print(f"vCPU: {config.get('vcpu', '-')}")
1204 print(f"Memory: {config.get('memory', '-')}MB")
1205 print(f"Disk: {config.get('disk_size', '-')}GB")
1206 print(f"GPUs: {self._format_gpu_info(config.get('gpus'))}")
1207 print(f"Boot Progress: {info.get('boot_progress', '-')}")
1208 if info.get("boot_error"):
1209 print(f"Boot Error: {info['boot_error']}")
1210 if info.get("exited_at"):
1211 print(f"Exited At: {info['exited_at']}")
1212 if info.get("shutdown_progress"):
1213 print(f"Shutdown: {info['shutdown_progress']}")
1214
1215 events = info.get("events", [])
1216 if events:
1217 print("\nRecent Events:")
1218 for event in events[-10:]:
1219 ts = event.get("timestamp", 0)
1220 print(
1221 f" [{event.get('event', '')}] {event.get('body', '')} (ts: {ts})"
1222 )
1223
1224 def list_gpus(self, json_output: bool = False) -> None:
1225 """List all available GPUs."""

Callers 1

mainFunction · 0.95

Calls 3

rpc_callMethod · 0.95
_format_gpu_infoMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected