Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent committed Nov 22, 2024
1 parent ccab591 commit e9bfd73
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
5 changes: 2 additions & 3 deletions openhands/runtime/action_execution_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import io
import mimetypes
import os
import psutil
import shutil
import tempfile
import time
Expand Down Expand Up @@ -422,11 +421,11 @@ async def get_server_info():
current_time = time.time()
uptime = current_time - client.start_time
idle_time = current_time - client.last_execution_time

return {
'uptime': uptime,
'idle_time': idle_time,
'resources': get_system_stats()
'resources': get_system_stats(),
}

@app.post('/execute_action')
Expand Down
11 changes: 6 additions & 5 deletions openhands/runtime/utils/system_stats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Utilities for getting system resource statistics."""

import time

import psutil


Expand Down Expand Up @@ -46,16 +47,16 @@ def get_system_stats() -> dict:
'memory': {
'rss': memory_info.rss,
'vms': memory_info.vms,
'percent': memory_percent
'percent': memory_percent,
},
'disk': {
'total': disk_usage.total,
'used': disk_usage.used,
'free': disk_usage.free,
'percent': disk_usage.percent
'percent': disk_usage.percent,
},
'io': {
'read_bytes': io_stats.get('read_bytes', 0),
'write_bytes': io_stats.get('write_bytes', 0)
}
}
'write_bytes': io_stats.get('write_bytes', 0),
},
}
4 changes: 2 additions & 2 deletions tests/runtime/utils/test_system_stats.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tests for system stats utilities."""

import psutil
import pytest

from openhands.runtime.utils.system_stats import get_system_stats


Expand Down Expand Up @@ -55,4 +55,4 @@ def test_get_system_stats_stability():
for _ in range(3):
stats = get_system_stats()
assert isinstance(stats, dict)
assert stats['cpu_percent'] >= 0
assert stats['cpu_percent'] >= 0

0 comments on commit e9bfd73

Please sign in to comment.