Skip to content

Commit fd2281b

Browse files
committed
json: When process information is unavailable, expose as null
The `processes' field of GPUStat as json is changed to be `null` instead of a string (NOT_SUPPORTED) when process information is not available. Refs: #45, #10
1 parent 54ebfda commit fd2281b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

gpustat/core.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,10 @@ def full_process_info(p):
330330
return fp
331331

332332
def jsonify(self):
333-
o = dict(self.entry)
333+
o = self.entry.copy()
334334
if self.entry['processes'] is not None:
335335
o['processes'] = [{k: v for (k, v) in p.items() if k != 'gpu_uuid'}
336336
for p in self.entry['processes']]
337-
else:
338-
o['processes'] = '({})'.format(NOT_SUPPORTED)
339337
return o
340338

341339

0 commit comments

Comments
 (0)