Add node to partition/reservation?

63 views
Skip to first unread message

Tommy Jay

unread,
Jan 25, 2018, 3:12:43 PM1/25/18
to pyslurm
Hello,

Is there any possiblity to add node to partition/reservation using pyslurm?
If yes how to save configuration from pyslurm?

Good job :) BTW
---
Thx,
Tommy

Giovanni

unread,
Jan 25, 2018, 6:05:44 PM1/25/18
to pyslurm
You can add nodes to partitions and reservations in the running config via pyslurm.  I'm not aware of a way to save the changes to the running slurm config.  Here's how to add a node a partition and a reservation:

# partition
>>> import pyslurm
>>> p = pyslurm.partition()
>>> p.get()['normal']['nodes']
u'c[1-5]'
>>> new_nodes = {'Name': 'normal', 'Nodes': 'c[1-6]'}
>>> p.update(new_nodes)
0
>>> p.get()['normal']['nodes']
u'c[1-6]'
>>>

# reservation
>>> import time
>>> resv_test = {
...         "node_list": "c[1-2]",
...         "users": 'root,slurm',
...         "start_time": int(time.time()),
...         "duration": 600,
...         "name": "resv_test"
... }
>>>
>>> pyslurm.reservation().create(resv_test)
u'resv_test'
>>>
>>> resv_update = {'name': 'resv_test', 'node_list': 'c[1-4]'}
>>> pyslurm.reservation().update(resv_update)
0
>>>
>>> pyslurm.reservation().get()['resv_test']['node_list']
u'c[1-4]'
>>>

You can also verify both operations with scontrol show commands:

[root@ernie ~]# scontrol show partitions normal
PartitionName=normal
   AllowGroups=ALL AllowAccounts=ALL AllowQos=ALL
   AllocNodes=ALL Default=YES QoS=N/A
   DefaultTime=5-00:00:00 DisableRootJobs=NO ExclusiveUser=NO GraceTime=0 Hidden=NO
   MaxNodes=5 MaxTime=5-00:00:00 MinNodes=1 LLN=NO MaxCPUsPerNode=UNLIMITED
   Nodes=c[1-6]
   PriorityJobFactor=50 PriorityTier=50 RootOnly=NO ReqResv=NO OverSubscribe=NO
   OverTimeLimit=NONE PreemptMode=OFF
   State=UP TotalCPUs=6 TotalNodes=6 SelectTypeParameters=NONE
   DefMemPerCPU=500 MaxMemPerNode=UNLIMITED

[root@ernie ~]# scontrol show reservations     
ReservationName=resv_test StartTime=2018-01-25T22:51:57 EndTime=2018-01-26T08:51:57 Duration=10:00:00
   Nodes=c[1-4] NodeCnt=4 CoreCnt=4 Features=(null) PartitionName=(null) Flags=SPEC_NODES
   TRES=cpu=4
   Users=root,slurm Accounts=(null) Licenses=(null) State=ACTIVE BurstBuffer=(null) Watts=n/a


At this point, you would have to update slurm.conf manually to make the partition changes permanent, as I don't think there is an equivalent scontrol command in slurm to save a running config to slurm.conf, but that would be a nice feature.

Giovanni
Reply all
Reply to author
Forward
0 new messages