Skip to content

Commit 23c9d69

Browse files
return tres_per_task as a dict
1 parent aaf7385 commit 23c9d69

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pyslurm/core/job/job.pyx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,21 @@ cdef class Job:
12371237
def gres_per_node(self):
12381238
return cstr.to_gres_dict(self.ptr.tres_per_node)
12391239

1240+
@property
1241+
def tres_per_task(self):
1242+
tres_str = cstr.to_unicode(self.ptr.tres_per_task)
1243+
if not tres_str:
1244+
return None
1245+
1246+
cdef:
1247+
dict a = {}
1248+
char *i
1249+
# eg. cpu=1,gres/gpu=1
1250+
for i in tres_str.split(","):
1251+
a[i.split("=")[0]] = int(i.split("=")[1])
1252+
1253+
return a
1254+
12401255
@property
12411256
def profile_types(self):
12421257
return acctg_profile_int_to_list(self.ptr.profile)

0 commit comments

Comments
 (0)