Pbsnodes -c equivalent in PTL

Hi. Is there a pbsnodes -c equivalent function in PTL?
I am writing a test that offlines a vnode and I would like to change its state back to free but I could not find a function to do that in the API documentation.

Thanks

As it turns out, pbsnodes -c isn’t really all that special. All it really does is a qmgr -c ‘s n <node_name> state=free’

So you can use self.server.manager() to do the same thing. You have two options:

self.server.manager(MGR_CMD_SET, NODE, {‘state’: ‘free’}, id=node_id)

OR

self.server.manager(MGR_CMD_SET, NODE, {‘state’: (DECR, ‘offline’)}, id=node_name)

The first does what pbsnodes -c does. It literally will set the node state to free no matter what the state was. The second removes offline. The node will retain any other states it had.

Bhroam

Thanks @bhroam. Do you know how to clear a vnode’s comment attribute?

You still use manager().

Try: self.server.manager(MGR_CMD_UNSET, NODE, ‘comment’, id=node_name)

Just a (non PTL specific) note about this: using pbsnodes -c nodename and qmgr -c “s n nodename state=free” are generally dangerous and frowned upon in normal product usage. Better to use pbsnodes -r nodename, which is the equivalent of qmgr -c “s n nodename state -=offline”. It just removes the offline status and lets the server decide what the true state ought to be rather than forcing “free”, which may not actually be correct.