Skip to content

Commit 0bdd63d

Browse files
committed
address code review
1 parent b004b1f commit 0bdd63d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

distributed/diagnostics/nvml.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from packaging.version import parse as parse_version
99

1010
import dask
11+
from dask.utils import ensure_unicode
1112

1213
try:
1314
import pynvml
@@ -68,11 +69,6 @@ def _in_wsl():
6869
return "microsoft-standard" in uname().release
6970

7071

71-
def _maybe_decode(value):
72-
"""Decode if bytes instance"""
73-
return value.decode() if isinstance(value, bytes) else value
74-
75-
7672
def init_once():
7773
"""Idempotent (per-process) initialization of PyNVML
7874
@@ -110,7 +106,7 @@ def init_once():
110106
return
111107

112108
if _in_wsl() and parse_version(
113-
_maybe_decode(pynvml.nvmlSystemGetDriverVersion())
109+
ensure_unicode(pynvml.nvmlSystemGetDriverVersion())
114110
) < parse_version(MINIMUM_WSL_VERSION):
115111
NVML_STATE = NVMLState.DISABLED_WSL_INSUFFICIENT_DRIVER
116112
return

0 commit comments

Comments
 (0)