Find partitions for node

51 views
Skip to first unread message

Georgios Nikolis

unread,
Feb 15, 2018, 7:25:28 AM2/15/18
to pyslurm
Dear all,
I would like to be able for a given node to query the partitions this node is in. I would think that something like the following would do the trick:
pyslurm.node().get()['xgs-node079']['partitions']

The problem that I have though is that for all nodes the partition key in the node dict as returned by pyslurm.node().get() has an empty list as value:
In [35]: nodes = pyslurm.node().get()

In [36]: [nodes[node]['partitions'] for node in nodes]
Out[36]: [[], [], [], [], [], []]

SLURM itself seems to be able to deliver this information on a node basis though; in the scontrol show node output for instance the Partitions entry is correct:
[root@htseq-slurmdb ~]# scontrol show node xgs-node079
NodeName=xgs-node079 CoresPerSocket=1
   CPUAlloc=0 CPUErr=0 CPUTot=72 CPULoad=0.16
   AvailableFeatures=(null)
   ActiveFeatures=(null)
   Gres=(null)
   NodeAddr=xgs-node079 NodeHostName=xgs-node079
   RealMemory=510000 AllocMem=0 FreeMem=12728 Sockets=72 Boards=1
   State=IDLE ThreadsPerCore=1 TmpDisk=0 Weight=1 Owner=N/A MCS_label=N/A
   Partitions=hidden
   BootTime=None SlurmdStartTime=None
   CfgTRES=cpu=72,mem=510000M
   AllocTRES=
   CapWatts=n/a
   CurrentWatts=0 LowestJoules=0 ConsumedJoules=0
   ExtSensorsJoules=n/s ExtSensorsWatts=0 ExtSensorsTemp=n/s

Apparently the partition information for a node won't be accessed correctly by pyslurm.
Has anyone seen this behavior already? I would appreciate any hint that could lead to a solution.

Thanks in advance!
Georgios

Giovanni

unread,
Feb 15, 2018, 11:36:11 PM2/15/18
to pyslurm
Hi Georgios,

This is a bug in PySlurm.  The node dictionary is populated with `char* partitions` struct member, but this is populated by scontrol.  This means pyslurm would have to perform this extra step in order to populate it.  I'll have a look.

Thanks,
Giovanni

Giovanni

unread,
Feb 16, 2018, 12:02:24 AM2/16/18
to pyslurm


On Thursday, February 15, 2018 at 11:36:11 PM UTC-5, Giovanni wrote:
Hi Georgios,

This is a bug in PySlurm.  The node dictionary is populated with `char* partitions` struct member, but this is populated by scontrol.  This means pyslurm would have to perform this extra step in order to populate it.  I'll have a look.


I have a fix pending.  I should have it merged into master soon.

Giovanni

Georgios Nikolis

unread,
Feb 16, 2018, 2:54:47 AM2/16/18
to pyslurm
Hi Giovanni,
awesome! Thank you very much!
Best,
Georgios

Giovanni

unread,
Feb 16, 2018, 9:41:47 AM2/16/18
to pyslurm


On Friday, February 16, 2018 at 2:54:47 AM UTC-5, Georgios Nikolis wrote:
Hi Giovanni,
awesome! Thank you very much!

Ok, the change is in master now.  Are you using slurm 17.11?

Giovanni

Giovanni

unread,
Feb 16, 2018, 10:39:38 AM2/16/18
to pyslurm
I forgot to add an example:

>>> import pyslurm
>>> pyslurm.node().get()["c1"]["partitions"]
[u'normal']


Reply all
Reply to author
Forward
0 new messages