fix up a couple cases
@@ -81,15 +81,15 @@ def Cpu():
return cpu
def Gpu():
- gpu = "unknown"
+ gpu = ""
try:
d_client = docker.from_env()
nvidia_image = d_client.images.list(name='nvidia/cuda:8.0-runtime')
if len(nvidia_image) > 0:
- proc = subprocess.Popen(['/usr/bin/nvidia-docker run --rm nvidia/cuda:8.0-runtime nvidia-smi -L'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+ proc = subprocess.Popen(['nvidia-docker run --rm nvidia/cuda:8.0-runtime nvidia-smi -L'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
gpus = proc.stdout.read()
if gpus:
- for line in gpus.split("\n"):
+ for line in gpus.strip().split("\n"):
gpu += line.split("(UUID: ")[0] + ", "
gpu = gpu[:-2]
else:
@@ -97,7 +97,7 @@ def Gpu():
else:
gpu = "None"
except Exception as e: # pragma: no cover
- pass
+ gpu = "Unknown"
return gpu
def Images(vent=True):
