Skip to content

Commit 6f49056

Browse files
authored
Convert mcs_label from bytes to string if defined (#207)
When it is defined, the mcs_label on nodes are bytes: # python3 Python 3.6.8 (default, Dec 5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pyslurm >>> pyslurm.node().get()['cn1']['mcs_label'] b'label' >>> type(pyslurm.node().get()['cn1']['mcs_label']) <class 'bytes'> With this commit, it is converted to a unicode string for easier handling by consumer.
1 parent 4665ed3 commit 6f49056

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

pyslurm/pyslurm.pyx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3122,11 +3122,7 @@ cdef class node:
31223122
slurm.stringOrNone(record.gres_used, '')
31233123
)
31243124

3125-
if record.mcs_label == NULL:
3126-
Host_dict[u'mcs_label'] = None
3127-
else:
3128-
Host_dict[u'mcs_label'] = record.mcs_label
3129-
3125+
Host_dict[u'mcs_label'] = slurm.stringOrNone(record.mcs_label, '')
31303126
Host_dict[u'mem_spec_limit'] = record.mem_spec_limit
31313127
Host_dict[u'name'] = slurm.stringOrNone(record.name, '')
31323128

0 commit comments

Comments
 (0)