Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add System Information Retrieval #32

Merged
merged 4 commits into from
Dec 20, 2024
Merged

Conversation

CuriousDolphin
Copy link
Member

@CuriousDolphin CuriousDolphin commented Dec 20, 2024

TITLE

Add System Information Retrieval

CONTEXT

This PR was created to provide users with detailed system diagnostics and robust HTTP request capabilities, improving resource management and integration.

KEY CHANGES

  • Introduced SystemInfo and GPUInfo classes for comprehensive system diagnostics.
  • Enhanced HttpClient with detailed docstrings and additional HTTP methods.
  • Updated Makefile to include a test target.
  • Added new dependencies: gputil, psutil, and setuptools.
  • Implemented tests for system information retrieval and HTTP client functionality.
  • Updated the notebook to include system information retrieval.

IMPACT

These changes provide users with enhanced capabilities to gather system information and perform HTTP requests, facilitating better integration and resource management.

TECHNICAL DETAILS

System Information

Utilizes platform, psutil, and GPUtil to gather system metrics such as CPU, memory, disk, and GPU details. The get_system_info function returns a SystemInfo object with this data.

from focoos.utils.system import get_system_info

system_info = get_system_info()
system_info.pretty_print()

HTTP Client

The HttpClient class now includes detailed docstrings for its methods, providing clarity on usage. It supports GET, POST, and DELETE requests with customizable headers and parameters.

client = HttpClient(api_key="test_key", host_url="http://example.com")
response = client.get("test/path")

Available infos

class SystemInfo(FocoosBaseModel):
    focoos_host: Optional[str] = None
    system: Optional[str] = None
    system_name: Optional[str] = None
    cpu_type: Optional[str] = None
    cpu_cores: Optional[int] = None
    memory_gb: Optional[float] = None
    memory_used_percentage: Optional[float] = None
    available_providers: Optional[list[str]] = None
    disk_space_total_gb: Optional[float] = None
    disk_space_used_percentage: Optional[float] = None
    gpu_count: Optional[int] = None
    gpu_driver: Optional[str] = None
    gpu_cuda_version: Optional[str] = None
    gpus_info: Optional[list[GPUInfo]] = None
    packages_versions: Optional[dict[str, str]] = None

Testing

Added unit tests for the new system information functions and the enhanced HTTP client to ensure reliability and correctness.

CuriousDolphin and others added 2 commits December 20, 2024 12:03
Improve system diagnostics by adding GPU and system information classes
Copy link

github-actions bot commented Dec 20, 2024

@CuriousDolphin CuriousDolphin merged commit 4f222c8 into main Dec 20, 2024
3 checks passed
@CuriousDolphin CuriousDolphin deleted the feat/add-system-info branch December 20, 2024 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants