|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST] ms-planner: add a flight summary html report
I often find myself intested in when a given flight (or the current flight for
a branch) will complete, which with the current resource plan means searching
and cycling through trying to figure out which box ends the latest.
Add an explicit flight status summary, which produces a table for each flight
listing the jobs, there start and end times and the host they run on. The
output is something like a list of these, ordered by flight number (rendered
with links(1), header is bold):
Flight 26043 [linux-3.4 real] 4 jobs expected to run until 2014-Apr-27 Sun
23:54:19
build-amd64-pvops 2014-Apr-27 Sun 20:06:09
2014-Apr-27 Sun 21:21:23 host leaf-beetle
build-i386-pvops 2014-Apr-27 Sun 21:20:15
2014-Apr-27 Sun 21:31:27 host grain-weevil
build-amd64 2014-Apr-27 Sun 21:21:23
2014-Apr-27 Sun 21:44:22 host leaf-beetle
build-i386 2014-Apr-27 Sun 22:18:43
2014-Apr-27 Sun 23:54:19 host field-cricket
I renamed the existing show-html option to show-resource-plan-html for clarity.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
It'd be good to sync these reports to e.g. xenbits so other people can see
them. Pressumably this would be reasonably easy with a ssh keypair restricted
in authorized_keys.
---
ms-planner | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
ms-queuedaemon | 10 ++++++--
2 files changed, 82 insertions(+), 3 deletions(-)
diff --git a/ms-planner b/ms-planner
index f045bbf..4d9787d 100755
--- a/ms-planner
+++ b/ms-planner
@@ -536,7 +536,80 @@ sub showsharetype ($) {
return $_;
}
-sub cmd_show_html () {
+sub cmd_show_flight_summary_html () {
+ get_current_plan();
+
+ my $earliest= $plan->{Start};
+
+ my %flights;
+ my $jobs = 0;
+ while (my ($reso,$evts) = each %{ $plan->{Events} }) {
+ # [osstest real] job 26010.test-amd64-amd64-xl-win7-amd64
+ foreach my $evt ( @{$evts} ) {
+ next unless $evt->{Type} =~ m/^(Start|End)$/;
+ next unless $evt->{Info} =~ m/^\[(\S+) (\S+)\] job ([0-9]+)\.(\S+)
(.*)/;
+ my ($branch,$blessing,$flight,$job,$rest) = ($1,$2,$3,$4,$5);
+ $flights{$flight} = {
+ Branch => $branch,
+ Blessing => $blessing,
+ End => $evt->{Time},
+ Jobs => {},
+ Last => $evt,
+ LastReso => $reso,
+ } unless $flights{$flight};
+ $jobs++;
+ $flights{$flight}->{Jobs}{$job} = {
+ Reso => $reso
+ } unless $flights{$flight}->{Jobs}{$job};
+
+ $flights{$flight}->{Jobs}{$job}->{Start} = $evt if $evt->{Type} eq
"Start";
+ $flights{$flight}->{Jobs}{$job}->{End} = $evt if $evt->{Type} eq
"End";
+
+ if ( $evt->{Time} > $flights{$flight}->{End} ) {
+ $flights{$flight}->{Last} = $evt;
+ $flights{$flight}->{LastReso} = $reso;
+ $flights{$flight}->{End} = $evt->{Time};
+ }
+ }
+ }
+
+ my @cols = ("Job", "Start", "End", "Host");
+
+ printf("<table>\n<tr>\n");
+ printf(" <th align='left'>%s</th>\n", encode_entities($_)) foreach @cols;
+ printf("</tr>\n");
+
+ sub flight_hdr($) {
+ my $text = encode_entities(shift);
+ printf("<tr><td colspan=%d><b>$text</b></td></tr>", scalar @cols);
+ }
+ sub cell($) {
+ my $text = encode_entities(shift);
+ printf(" <td>$text</td>\n");
+ }
+ foreach my $flight (sort keys %flights) {
+ my $inf = $flights{$flight};
+
+ flight_hdr("Flight $flight [$inf->{Branch} $inf->{Blessing}] ".
+ (keys %{$inf->{Jobs}})." jobs ".
+ "expected to run until ".strftime("%Y-%b-%d %a %H:%M:%S",
localtime $inf->{End}));
+
+ foreach my $job (sort { $inf->{Jobs}{$a}->{Start}->{Time} cmp
$inf->{Jobs}{$b}->{Start}->{Time} } keys %{ $inf->{Jobs} }) {
+ my $sevt = $inf->{Jobs}{$job}->{Start};
+ my $eevt = $inf->{Jobs}{$job}->{End};
+ print("<tr>\n");
+ cell($job);
+ cell(strftime("%Y-%b-%d %a %H:%M:%S", localtime
$inf->{Jobs}{$job}->{Start}->{Time}));
+ cell(strftime("%Y-%b-%d %a %H:%M:%S", localtime
$inf->{Jobs}{$job}->{End}->{Time}));
+ cell($inf->{Jobs}{$job}->{Reso});
+ print("</tr>\n");
+ }
+ print("<tr><td> </td></tr>\n");
+ }
+ print("</table>\n");
+}
+
+sub cmd_show_resource_plan_html () {
get_current_plan();
my $now= time;
diff --git a/ms-queuedaemon b/ms-queuedaemon
index 26d83e2..a5bebd3 100755
--- a/ms-queuedaemon
+++ b/ms-queuedaemon
@@ -224,12 +224,18 @@ proc queuerun-perhaps-step {} {
proc report-plan {} {
global c
if {[catch {
- exec ./ms-planner show-html > "$c(WebspaceFile)/resource-plan.html"
+ exec ./ms-planner show-resource-plan-html >
"$c(WebspaceFile)/resource-plan.html"
} emsg]} {
- log "INTERNAL ERROR showing plan html: $emsg"
+ log "INTERNAL ERROR showing resource plan html: $emsg"
} else {
log "report-plan OK"
}
+ if {[catch {
+ exec ./ms-planner show-flight-summary-html >
"$c(WebspaceFile)/flight-summary.html"
+ } emsg]} {
+ log "INTERNAL ERROR showing flight summary html: $emsg"
+ } else {
+ log "report-flight-summary OK"
}
proc we-are-thinking {chan} {
--
1.9.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |