Skip to content

Commit

Permalink
add disk usage to hw_info, telemetry and load_info
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaiPetukhov committed Dec 6, 2024
1 parent 4589663 commit 703c593
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions agent/worker/system_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

import supervisely_lib as sly

from worker import constants


# Some functions below perform dirty parsing of corresponding utils output.
# @TODO: They shall be replaced with more portable implementations.

Expand Down Expand Up @@ -117,6 +120,17 @@ def get_hw_info():
"cpuinfo": sly.catch_silently(parse_cpuinfo),
"meminfo": sly.catch_silently(parse_meminfo),
"nvidia-smi": sly.catch_silently(print_nvsmi_devlist),
"disk_usage": get_disk_usage(),
}
return res


def get_disk_usage():
disk_usage = psutil.disk_usage(constants.AGENT_ROOT_DIR()) # root dir mounted to host
res = {
"total": disk_usage.total,
"used": disk_usage.used,
"free": disk_usage.free,
}
return res

Expand All @@ -132,6 +146,7 @@ def get_load_info():
"total": vmem[0],
"available": vmem[1],
},
"disk_usage": get_disk_usage(),
}
return res

Expand Down
3 changes: 2 additions & 1 deletion agent/worker/telemetry_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from worker.task_logged import TaskLogged
from worker import constants
from worker.system_info import get_directory_size_bytes, get_gpu_info
from worker.system_info import get_directory_size_bytes, get_gpu_info, get_disk_usage


class TelemetryReporter(TaskLogged):
Expand Down Expand Up @@ -114,6 +114,7 @@ def get_telemetry_str(self):
"node_storage": node_storage,
"docker_image": docker_image,
"gpu_info": get_gpu_info(self.logger),
"disk_usage": get_disk_usage(),
}

info_str = json.dumps(server_info)
Expand Down

0 comments on commit 703c593

Please sign in to comment.