Commit a1925dda authored by Mike Hibler's avatar Mike Hibler

Merge branch 'master' of gitlab.flux.utah.edu:emulab/emulab-devel

parents 4ccb5dd1 8048f20e
......@@ -442,6 +442,11 @@ sub SliceUtilizationData($)
if (defined($counts)) {
$typelist{$typeinfo->type()}->{"total"} = $counts->{"total"};
$typelist{$typeinfo->type()}->{"free"} = $counts->{"free"};
my $reserve_free = Reservation->FreeCount($type);
if ($reserve_free) {
$typelist{$typeinfo->type()}->{"reserve_free"} = $reserve_free;
}
}
}
my $results = {"api_version" => $API_VERSION,
......@@ -477,7 +482,7 @@ sub SliceIdleData($)
my $pid = $experiment->pid();
my $eid = $experiment->eid();
my $swapped = str2time($experiment->swapin_last());
my $limit = time() - (3600 * 24 * 3);
my $limit = time() - (3600 * 24 * 6);
if ($limit < $swapped) {
$limit = $swapped;
}
......
......@@ -207,6 +207,12 @@ $(function ()
var html = summaryTemplate({"utilization" : json.value});
$("#thirdrow").html(html);
// This activates the tooltip subsystem.
$('[data-toggle="tooltip"]').tooltip({
delay: {"hide" : 500, "show" : 150},
placement: 'auto',
});
};
var xmlthing = sup.CallServerMethod(null, "status", "Utilization",
{"uuid" : window.UUID});
......
......@@ -1045,6 +1045,8 @@ $(function ()
var projectReservations = {}
var requested = 0;
var inuse = 0;
var ready = 0;
var reloading = 0;
$('#reservation_confirmation').addClass('hidden');
$('#reservation_warning').addClass('hidden');
......@@ -1110,12 +1112,12 @@ $(function ()
function(thelist, resproj) {
_.each(thelist,
function(obj) {
var req = obj.reserved;
var used = obj.used;
var type = obj.nodetype;
console.info("current", req, used, type,
resproj, project);
var req = obj.reserved;
var used = obj.used;
var type = obj.nodetype;
console.info("current", req, used, obj.ready,
obj.reloading, type, resproj, project);
// Current project has a current reservation
// Used for cluster icons
......@@ -1125,6 +1127,8 @@ $(function ()
// All nodes for current project reservations.
requested += parseInt(req);
inuse += parseInt(used);
ready += parseInt(obj.ready);
reloading += parseInt(obj.reloading);
currentReservations = true;
}
projectReservations[resproj] = {
......@@ -1160,11 +1164,15 @@ $(function ()
}
if (hasReservation || start != null) {
//console.info("res", project, start, end, earliest,
// requested, inuse);
if (0) {
console.info("res", project, start, end, earliest,
requested, inuse, ready, reloading);
}
$(this).attr('data-res-pid', project);
$(this).attr('data-res-requested', requested);
$(this).attr('data-res-used', inuse);
$(this).attr('data-res-ready', ready);
$(this).attr('data-res-reloading', reloading);
if (hasReservation) {
$(this).removeAttr('data-res-end');
$(this).removeAttr('data-res-upcoming');
......@@ -1197,6 +1205,8 @@ $(function ()
$(this).removeAttr('data-res-end');
$(this).removeAttr('data-res-requested');
$(this).removeAttr('data-res-used');
$(this).removeAttr('data-res-ready');
$(this).removeAttr('data-res-reloading');
$(this).removeAttr('data-res-upcoming');
}
}
......
......@@ -47,8 +47,6 @@ window.wt = (function() {
if ($(that).parent().attr('data-res-pid')) {
var project = $(that).parent().attr('data-res-pid');
var requested = $(that).parent().attr('data-res-requested');
var used = $(that).parent().attr('data-res-used');
if ($(that).parent().attr('data-res-start')) {
var start = new Date(parseInt($(that).parent()
......@@ -67,15 +65,32 @@ window.wt = (function() {
$('#reservation_warning').addClass('hidden');
if ($(that).parent().attr('data-now') == 'true') {
var requested =
$(that).parent().attr('data-res-requested');
var used =
$(that).parent().attr('data-res-used');
var ready =
$(that).parent().attr('data-res-ready');
var reloading =
$(that).parent().attr('data-res-reloading');
$(this).attr('data-res-pid', project);
$('#reservation_future').addClass('hidden');
$('#reservation_confirmation .reservation_requested')
.html(requested);
$('#reservation_confirmation .reservation_used')
.html(used);
$('#reservation_confirmation .reservation_project')
.html(project);
$('#reservation_confirmation').removeClass('hidden');
var warning =
CurrentReservationWarning(project,
parseInt(requested),
parseInt(used),
parseInt(ready),
parseInt(reloading));
if (warning) {
$('#reservation_confirmation #reservation_text')
.html(warning);
$('#reservation_confirmation')
.removeClass('hidden');
}
}
else {
var start = new Date(parseInt($(that).parent()
......@@ -261,6 +276,47 @@ window.wt = (function() {
+'</div></div>'
}
function CurrentReservationWarning(project, requested,
used, ready, reloading)
{
var html = "Project " + project + " " +
"has reservations on this cluster for " + requested + " " +
"nodes. ";
if (used >= requested) {
html = html +
"Currently the project has all of the nodes " +
"in the reservation.";
}
else if (used + ready >= requested) {
html = html +
"The project is currently using " + used + " " +
"nodes, " + (requested - used) + " " +
"nodes are immediately available.";
}
else if (used + ready + reloading >= requested) {
html = html +
"The project is currently using " + used + " " +
"nodes, " + ready + " nodes " +
"are immediately available, " +
(requested - (used + ready)) + " nodes will be available " +
"very soon.";
}
else {
html = html +
"The project is currently using " + used + " nodes";
if (ready) {
html = html +
", " + ready + " are immediately available";
}
if (reloading) {
html = html +
", " + reloading + " will be available very soon";
}
html = html + ".";
}
return html;
}
return {
StatusClickEvent: StatusClickEvent,
ResClickEvent: ResClickEvent,
......
......@@ -10,7 +10,15 @@
<th>Type</th>
<th>Cluster</th>
<th>Used</th>
<th>Free</th>
<th>Free
<a href='#' class='btn btn-xs'
data-toggle='tooltip'
data-container="body"
title='Reservation system prediction in parens'
data-trigger="hover"><span
class='glyphicon glyphicon-question-sign'
style='margin-bottom: 4px;'></a></span>
</th>
<th>Total</th>
</tr>
</thead>
......@@ -21,7 +29,14 @@
<td><%- type %></td>
<td><%- name %></td>
<td><%- info.count %></td>
<td><%- info.free %></td>
<td>
<%- info.free %>
<% if (_.has(info, "reserve_free")) { %>
(<%- info.reserve_free %>)
<% } else { %>
(n/a)
<% } %>
</td>
<td><%- info.total %></td>
</tr>
<% }); %>
......
......@@ -356,8 +356,11 @@
<div id='reservation_warning' class='hidden col-sm-12'>
<label id='reservation_text' class='alert-warning col-sm-10 col-sm-offset-1'>There is an upcoming reservation on this cluster that may impact your ability to reserve or extend resources. This reservation is from <span class='reservation_start'>start</span> until <span class='reservation_end'>end</span>.</label>
</div>
<div id='reservation_confirmation' class='hidden col-sm-12'>
<label id='reservation_text' class='alert-success col-sm-10 col-sm-offset-1'>Project <span class="reservation_project"></span> has reservations on this cluster for <span class="reservation_requested"></span> nodes, of which <span class="reservation_used"></span> are already allocated by the project.</label>
<div id='reservation_confirmation'
class='hidden col-sm-12'>
<label id='reservation_text'
class='alert-success col-sm-10 col-sm-offset-1'>
</label>
</div>
<div id='reservation_future' class='hidden col-sm-12'>
<label id='reservation_text' class='alert-warning col-sm-10 col-sm-offset-1'>Project <span class="reservation_project"></span> has a reservation on this cluster beginning <span class='reservation_start'>start</span>.</label>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment