I would like to dynamically build a list of partitions with extended attributes in my form.yml.erb file, all retrieved from the partitions definitions. As we leverage bin_overrides for slurm commands, I can’t call these commands directly.
So I’m looking for a code snippet on how to retrieve partitions and node info from the Slurm adaptor, including the initialization part.
Thank you,
Xavier
I understand auto_queues
is not where it should be, we don’t really use partitions like that at OSC so we’re lacking on that score. That said, I’d love auto_queues
to just fit your use case (and everyone else’s for that matter) I just sort of need data & use cases to build test cases against.
Here’s how ood_core
is pulling partition info. I believe it’s building QueueInfo
objects. This is what auto_queues
is built off of.
Thank you jeff for your reply. Yes I know auto_queue is here, however i want more than just the name of the partition, as i would like to dynamically build a description using some of the partition attributes. Like number of cores, GPUs, memory size. And in addition use some of these attributes to display other options. for example if a partition has GPU then I may display a GPU count field.
Here is what I would like to have in my form.yml.erb file. This code is not workable I just need to know which objects to use.
<%-
partitions = OodCore.Adaptors.Slurm.partitions
-%>
---
...
options:
<%- partitions.each do |p| -%>
- [ "<%= p.name %>", "<%= p.name, p.memory, p.core_count %>" ]
<%- end -%>
Thank you
<%-
adapter = OodAppkit.clusters[cluster.to_sym].job_adapter
partitions = adapter.queues
-%>
You could do this, but those objects don’t have memory or core_count and so on. Honestly you’re better of issuing the sinfo
command (and any others) in an initializer, create your own objects use those objects.
Here’s the object, and as you can see it doesn’t have the info you’re looking for.
Thanks Jeff, I will play with initializers then. I’ve seen a great session on them at the GOOD conference, will try to replicate some of these good25/dev/cluster/initializers/slurm_nodes_extension.rb at main · hmdc/good25
Well if you have an initializer like that - that’s modifying the original OOD source code. So if that’s the case, something like what’s below could work because you’ve redefined the queues
method. So your redefined queues
method will actually return what you want and not what we have.
<%-
adapter = OodAppkit.clusters[cluster.to_sym].job_adapter
partitions = adapter.queues
-%>