Spaces:
Running
Running
Commit
·
bc6e5cf
1
Parent(s):
d49c538
fix refresh timing
Browse files- vms/tabs/monitor_tab.py +13 -11
vms/tabs/monitor_tab.py
CHANGED
@@ -45,7 +45,7 @@ class MonitorTab(BaseTab):
|
|
45 |
super().__init__(app_state)
|
46 |
self.id = "monitor_tab"
|
47 |
self.title = "4️⃣ Monitor"
|
48 |
-
self.refresh_interval =
|
49 |
|
50 |
def create(self, parent=None) -> gr.TabItem:
|
51 |
"""Create the Monitor tab UI components"""
|
@@ -66,8 +66,8 @@ class MonitorTab(BaseTab):
|
|
66 |
with gr.Tab(label="Memory Usage") as memory_tab:
|
67 |
self.components["memory_plot"] = gr.Plot()
|
68 |
|
69 |
-
with gr.Tab(label="Per-Core CPU") as per_core_tab:
|
70 |
-
|
71 |
|
72 |
# System information summary in columns
|
73 |
with gr.Row():
|
@@ -117,7 +117,7 @@ class MonitorTab(BaseTab):
|
|
117 |
self.components["current_metrics"],
|
118 |
self.components["cpu_plot"],
|
119 |
self.components["memory_plot"],
|
120 |
-
self.components["per_core_plot"]
|
121 |
]
|
122 |
)
|
123 |
|
@@ -133,7 +133,7 @@ class MonitorTab(BaseTab):
|
|
133 |
self.components["current_metrics"],
|
134 |
self.components["cpu_plot"],
|
135 |
self.components["memory_plot"],
|
136 |
-
self.components["per_core_plot"]
|
137 |
]
|
138 |
)
|
139 |
|
@@ -167,7 +167,7 @@ class MonitorTab(BaseTab):
|
|
167 |
self.components["current_metrics"].value,
|
168 |
self.components["cpu_plot"].value,
|
169 |
self.components["memory_plot"].value,
|
170 |
-
self.components["per_core_plot"].value
|
171 |
)
|
172 |
|
173 |
def refresh_all(self) -> Tuple:
|
@@ -187,13 +187,13 @@ class MonitorTab(BaseTab):
|
|
187 |
storage_info_html = self.format_storage_info()
|
188 |
|
189 |
# Get current metrics
|
190 |
-
current_metrics = self.app.monitor.get_current_metrics()
|
191 |
-
metrics_html = self.format_current_metrics(current_metrics)
|
192 |
|
193 |
# Generate plots
|
194 |
cpu_plot = self.app.monitor.generate_cpu_plot()
|
195 |
memory_plot = self.app.monitor.generate_memory_plot()
|
196 |
-
per_core_plot = self.app.monitor.generate_per_core_plot()
|
197 |
|
198 |
return (
|
199 |
system_info_html,
|
@@ -203,7 +203,7 @@ class MonitorTab(BaseTab):
|
|
203 |
metrics_html,
|
204 |
cpu_plot,
|
205 |
memory_plot,
|
206 |
-
per_core_plot
|
207 |
)
|
208 |
|
209 |
except Exception as e:
|
@@ -215,7 +215,9 @@ class MonitorTab(BaseTab):
|
|
215 |
error_msg,
|
216 |
error_msg,
|
217 |
error_msg,
|
218 |
-
None,
|
|
|
|
|
219 |
)
|
220 |
|
221 |
def format_system_info(self, system_info: Dict[str, Any]) -> str:
|
|
|
45 |
super().__init__(app_state)
|
46 |
self.id = "monitor_tab"
|
47 |
self.title = "4️⃣ Monitor"
|
48 |
+
self.refresh_interval = 8
|
49 |
|
50 |
def create(self, parent=None) -> gr.TabItem:
|
51 |
"""Create the Monitor tab UI components"""
|
|
|
66 |
with gr.Tab(label="Memory Usage") as memory_tab:
|
67 |
self.components["memory_plot"] = gr.Plot()
|
68 |
|
69 |
+
#with gr.Tab(label="Per-Core CPU") as per_core_tab:
|
70 |
+
# self.components["per_core_plot"] = gr.Plot()
|
71 |
|
72 |
# System information summary in columns
|
73 |
with gr.Row():
|
|
|
117 |
self.components["current_metrics"],
|
118 |
self.components["cpu_plot"],
|
119 |
self.components["memory_plot"],
|
120 |
+
#self.components["per_core_plot"]
|
121 |
]
|
122 |
)
|
123 |
|
|
|
133 |
self.components["current_metrics"],
|
134 |
self.components["cpu_plot"],
|
135 |
self.components["memory_plot"],
|
136 |
+
#self.components["per_core_plot"]
|
137 |
]
|
138 |
)
|
139 |
|
|
|
167 |
self.components["current_metrics"].value,
|
168 |
self.components["cpu_plot"].value,
|
169 |
self.components["memory_plot"].value,
|
170 |
+
#self.components["per_core_plot"].value
|
171 |
)
|
172 |
|
173 |
def refresh_all(self) -> Tuple:
|
|
|
187 |
storage_info_html = self.format_storage_info()
|
188 |
|
189 |
# Get current metrics
|
190 |
+
# current_metrics = self.app.monitor.get_current_metrics()
|
191 |
+
metrics_html = "" # self.format_current_metrics(current_metrics)
|
192 |
|
193 |
# Generate plots
|
194 |
cpu_plot = self.app.monitor.generate_cpu_plot()
|
195 |
memory_plot = self.app.monitor.generate_memory_plot()
|
196 |
+
#per_core_plot = self.app.monitor.generate_per_core_plot()
|
197 |
|
198 |
return (
|
199 |
system_info_html,
|
|
|
203 |
metrics_html,
|
204 |
cpu_plot,
|
205 |
memory_plot,
|
206 |
+
#per_core_plot
|
207 |
)
|
208 |
|
209 |
except Exception as e:
|
|
|
215 |
error_msg,
|
216 |
error_msg,
|
217 |
error_msg,
|
218 |
+
None,
|
219 |
+
None,
|
220 |
+
#None
|
221 |
)
|
222 |
|
223 |
def format_system_info(self, system_info: Dict[str, Any]) -> str:
|