Skip to content

Commit

Permalink
refactor: add logging for missing nvidia-smi command in get_cuda_vers…
Browse files Browse the repository at this point in the history
…ion + ifelse logic return None
  • Loading branch information
giuseppeambrosio97 committed Dec 24, 2024
1 parent cf70cda commit 87c82d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 5 additions & 5 deletions focoos/utils/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

from focoos.config import FOCOOS_CONFIG
from focoos.ports import GPUInfo, SystemInfo
from focoos.utils.logger import get_logger

logger = get_logger(__name__)


class HttpClient:
Expand Down Expand Up @@ -155,11 +158,8 @@ def get_cuda_version() -> Optional[str]:
cuda_version = line.split(":")[-1].strip()
cuda_version = cuda_version.split()[0]
return cuda_version
return None
else:
return None
except FileNotFoundError:
return None
except FileNotFoundError as err:
logger.warning("nvidia-smi command not found: %s", err)


def get_gpu_name() -> Optional[str]:
Expand Down
2 changes: 0 additions & 2 deletions tests/test_system.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from unittest.mock import MagicMock, patch

import pytest

from focoos.ports import SystemInfo
from focoos.utils.system import (
HttpClient,
Expand Down

0 comments on commit 87c82d4

Please sign in to comment.