/* unknown status - might be bad */
background: #ff8888;
}
-.node-status-running {
+.node-status-running .node-status {
background: #88ff88;
}
-.node-status-missing {
+.node-status-missing .node-status {
background: #ff8888;
}
-.node-status-terminated {
+.node-status-terminated .node-status {
background: #ffffff;
}
+
+.node-slurm-state {
+ /* unknown status - might be bad */
+ background: #ff8888;
+}
+.node-status-missing .node-slurm-state {
+ background: #ffffff;
+}
+.node-status-terminated .node-slurm-state {
+ background: #ffffff;
+}
+.node-status-running .node-slurm-state-alloc {
+ background: #88ff88;
+}
+.node-status-running .node-slurm-state-idle {
+ background: #ffbbbb;
+}
+.node-status-running .node-slurm-state-down {
+ background: #ff8888;
+}
class NodesController < ApplicationController
def index
@objects = model_class.order("created_at desc")
+
+ @slurm_state = {}
+ IO.popen('sinfo --noheader --Node || echo "compute[1-3] foo bar DOWN"').readlines.each do |line|
+ tokens = line.strip.split
+ nodestate = tokens.last
+ nodenames = []
+ if (re = tokens.first.match /^([^\[]*)\[([-\d,]+)\]$/)
+ nodeprefix = re[1]
+ re[2].split(',').each do |number_range|
+ if number_range.index('-')
+ range = number_range.split('-').collect(&:to_i)
+ (range[0]..range[1]).each do |n|
+ nodenames << "#{nodeprefix}#{n}"
+ end
+ else
+ nodenames << "#{nodeprefix}#{number_range}"
+ end
+ end
+ else
+ nodenames << tokens.first
+ end
+ nodenames.each do |nodename|
+ @slurm_state[nodename] = nodestate.downcase
+ end
+ end
end
end
<tr class="contain-align-left">
<th>
status
+ </th><th>
+ sinfo
</th><th>
uuid
</th><th>
<% @objects.each do |o| %>
- <tr class="node-status node-status-<%= o.status %>" data-showhide-selector="tr#extra-info-<%= o.uuid %>" style="cursor:pointer">
- <td>
+ <tr class="node-status-<%= o.status %>">
+ <td class="node-status" data-showhide-selector="tr#extra-info-<%= o.uuid %>" style="cursor:pointer">
<%= o.status %>
+ </td><td class="node-slurm-state node-slurm-state-<%= @slurm_state[o.hostname] %>">
+ <%= @slurm_state[o.hostname] %>
</td><td>
<%= o.uuid %>
</td><td>
<% if %>
<tr id="extra-info-<%= o.uuid %>" <%= 'data-showhide-default' unless o.info[:ec2_start_command] and !o.first_ping_at %>>
- <td colspan="8">
+ <td colspan="9">
<dl>
<% o.info.each do |k,v| %>
<dt><em><%= k %></em></dt>