pyslurm.node and pyslurm.partition update format

32 views
Skip to first unread message

Christopher Coser US

unread,
Jun 12, 2019, 12:21:16 PM6/12/19
to pyslurm
Greetings!

I'm looking at using the .update features of pyslurm.node and pyslurm.partition as opposed to scontrol via CLI. However, I notice that create_node_dict seems to indicate that a numeric value for 'node_state' is expected:

>>> pyslurm.create_node_dict()
{'node_names': None, 'gres': None, 'reason': None, 'node_state': 0, 'weight': 0, 'features': None}

I've searched for a legend of numbers to state names but without success. Does such a mapping exist? How do I know what state corresponds to which number?

Another question I have is, how populated does the dict need to be? If I leave default values from create_*_dict, will it try to perform an update to all the included fields to the default values? If so, is the solution to remove the fields that I don't want to update prior to executing the .update method?


Thanks!

Giovanni

unread,
Jun 12, 2019, 10:37:12 PM6/12/19
to pyslurm
Hi Christopher,

Checkout node_update.py in the examples/ folder.  You would use the exposed NODE_STATE_* flags to designate the state that you want, and those flags in turn translate into the numeric equivalent for you.  Let me know if that helps or not.

I believe the mandatory fields are node_names, node_state, and reason, or Slurm itself will throw an error.  Here is the function that is responsible for updating the node: https://github.com/PySlurm/pyslurm/blob/18.08.0/pyslurm/pyslurm.pyx#L3473-L3522.  Here, you can see the valid keys for the node update dictionary.  Not providing an option in the update dictionary is equivalent to not providing that flag when using scontrol update node, and if Slurm has a problem with it, PySlurm will raise an exception and let you know.

Giovanni


Christopher Coser US

unread,
Jun 13, 2019, 9:10:19 AM6/13/19
to pyslurm
That's exactly what I needed. Thanks!
Reply all
Reply to author
Forward
0 new messages