Spaces:
Sleeping
Sleeping
wei9072 commited on
Commit ·
9837b4d
1
Parent(s): 5d3ccc6
fix test
Browse files- .github/workflows/ci.yml +1 -1
- backend/manager.py +2 -1
- requirements.txt +1 -0
.github/workflows/ci.yml
CHANGED
|
@@ -25,4 +25,4 @@ jobs:
|
|
| 25 |
|
| 26 |
- name: Run Pytest
|
| 27 |
run: |
|
| 28 |
-
pytest backend/tests/ -v
|
|
|
|
| 25 |
|
| 26 |
- name: Run Pytest
|
| 27 |
run: |
|
| 28 |
+
python -m pytest backend/tests/ -v
|
backend/manager.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import asyncio
|
| 2 |
import collections
|
| 3 |
import time
|
|
|
|
| 4 |
from typing import List, Optional, Callable, Any
|
| 5 |
from .collector import SystemCollector
|
| 6 |
from .schemas import SystemMetrics
|
|
@@ -17,7 +18,7 @@ class SystemDataManager:
|
|
| 17 |
"""Add a data point to the buffer."""
|
| 18 |
self.buffer.append(metrics)
|
| 19 |
if self.broadcast_callback:
|
| 20 |
-
if
|
| 21 |
asyncio.create_task(self.broadcast_callback(metrics))
|
| 22 |
else:
|
| 23 |
self.broadcast_callback(metrics)
|
|
|
|
| 1 |
import asyncio
|
| 2 |
import collections
|
| 3 |
import time
|
| 4 |
+
import inspect
|
| 5 |
from typing import List, Optional, Callable, Any
|
| 6 |
from .collector import SystemCollector
|
| 7 |
from .schemas import SystemMetrics
|
|
|
|
| 18 |
"""Add a data point to the buffer."""
|
| 19 |
self.buffer.append(metrics)
|
| 20 |
if self.broadcast_callback:
|
| 21 |
+
if inspect.iscoroutinefunction(self.broadcast_callback):
|
| 22 |
asyncio.create_task(self.broadcast_callback(metrics))
|
| 23 |
else:
|
| 24 |
self.broadcast_callback(metrics)
|
requirements.txt
CHANGED
|
@@ -5,5 +5,6 @@ pydantic
|
|
| 5 |
psutil
|
| 6 |
pytest
|
| 7 |
websockets
|
|
|
|
| 8 |
requests
|
| 9 |
rich
|
|
|
|
| 5 |
psutil
|
| 6 |
pytest
|
| 7 |
websockets
|
| 8 |
+
httpx
|
| 9 |
requests
|
| 10 |
rich
|