* [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights
@ 2015-09-16 13:07 Ian Campbell
2015-09-17 16:14 ` Ian Campbell
2015-09-18 9:02 ` [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights Ian Campbell
0 siblings, 2 replies; 14+ messages in thread
From: Ian Campbell @ 2015-09-16 13:07 UTC (permalink / raw)
To: ian.jackson, xen-devel; +Cc: Ian Campbell
Jobs are categorised by a new ->Job field. This is added by
ts-hosts-alllocate-Executive and propagated by the planner after
recent patches. It contains $flight.$job.
Jobs which do not include this are anonymous and are listed
separately, using the resource name and info field (if present) as the
job name.
Jobs which the plan describes as "(preparing)" (which I think means they
are waiting for another job to regroove build host for sharing) are
currently classified as anonymous until they are done preparing, at
which point they become correctly classified again. I can't see how
to figure out the correct ->{Job} at this point in the planner.
TODO: Hook up to ms-queuedaemon to run when a new projection is
complete.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
Example output:
http://xenbits.xen.org/people/ianc/tmp/fsummary-v4.html
also live at:
http://osstest.test-lab.xenproject.org/~ianc/summary.html
http://osstest.xs.citrite.net/~ianc/summary.html
for people who can see those.
v4: Major reworking, including:
- Include total number of flights + jobs in the header
- List the total number of jobs in each flight as well as the
current count of jobs with each status.
- Include plan time as well as report time in header
- Accept plan as an argument (no longer uses get-(last-)plan).
- Expected time now for "current phase" with a indiction what
proportion of jobs this includes.
- Use Osstest::Executive::report_run_getinfo.
- Use event's Info field if it is available.
v3:
- Author/S-o-b using correct hat.
- Much improved output, somewhat improved code (v2 was a bit more
WIP even than I had intended to send out).
- perl -w
v2:
- Get the plan from the queue daemon.
- Do not parse ->Info, instead expect a new ->Job field
- Handle multiple resources for a job.
---
ms-flights-summary | 387 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 387 insertions(+)
create mode 100755 ms-flights-summary
diff --git a/ms-flights-summary b/ms-flights-summary
new file mode 100755
index 0000000..60b6b88
--- /dev/null
+++ b/ms-flights-summary
@@ -0,0 +1,387 @@
+#!/usr/bin/perl -w
+
+use strict qw(vars refs);
+
+use Osstest;
+use Osstest::Executive;
+
+use POSIX;
+use Data::Dumper;
+use HTML::Entities;
+
+# $flights{NNNN} = {
+# Nr => NNNN,
+# Stats => {
+# Pass => <NRPASS>,
+# Fail => <NRFAIL>,
+# ...
+# },
+# Started => ...,
+# Blessing => ...,
+# Branch => ...,
+# Intended => ...,
+# ExpectedEnd => ...,
+# Jobs => {
+# JNAME1 => {
+# Reso => {
+# RNAME1 => {
+# Start => ...,
+# End => ...,
+# Info => ...,
+# },
+# RNAME2 => { ... },
+# },
+# OverallTime => { Start => ..., End => ... },
+# Receipe => ...,
+# Status => pass|fail|...,
+# },
+# JNAME2 => { ... },
+# },
+# };
+our %flights;
+
+# As for $flights{NNN}{Jobs} but each Job only has the Reso and
+# OverallTime keys, plus an additional Anon => 1
+our %anon_jobs;
+
+# As for $flights{NNNN} => Stats, but cummulative for all flights.
+our %global_stats;
+our $tot_jobs = 0;
+
+our $plan;
+
+sub get_current_plan ($) {
+ my ($fn) = @_;
+ open P, $fn or die $!;
+ local $/;
+ my $plandump= <P>;
+ P->error and die $!;
+ close P or die $!;
+ $plan= eval $plandump;
+ #print STDERR Dumper($plan);
+}
+
+# Find all the flights referenced by an Event and insert into %flights.
+sub enumerate_flights() {
+ while (my ($reso,$evts) = each %{ $plan->{Events} }) {
+ foreach my $evt ( @{$evts} ) {
+ next unless $evt->{Type} =~ m/^(Start|End)$/;
+ next unless $evt->{Job};
+ $evt->{Job} =~ m/^([0-9]+)\.(.*)/ or die;
+
+ my $f = $1;
+
+ next if $flights{$f};
+
+ my $flightinfo= $dbh_tests->selectrow_hashref(<<END);
+ SELECT started,blessing,branch,intended FROM flights
+ WHERE flight=$f
+END
+ $flights{$f}= { Nr => $f,
+ Stats => {},
+ Jobs => {} };
+ foreach my $fld (qw(started blessing branch intended)) {
+ $flights{$f}->{ucfirst($fld)}= $flightinfo->{$fld};
+ };
+ $flights{$f}->{ExpectedEnd} = 0;
+ }
+ }
+}
+
+# Enumerate all jobs of every known flight and populate the
+# corresponding ->{Jobs}.
+sub enumerate_jobs($) {
+ my ($f) = @_;
+
+ $f->{Jobs} = {};
+
+ my $jobs= $dbh_tests->selectall_arrayref(<<END, { Slice => {} });
+ SELECT job,recipe,status FROM jobs
+ WHERE flight=$f->{Nr}
+END
+
+ for my $row (@{$jobs}) {
+ $f->{Jobs}{$row->{job}} =
+ {
+ Status => $row->{status},
+ Recipe => $row->{recipe},
+ Reso => {},
+ };
+ $tot_jobs++;
+ }
+}
+
+# Gather statistics around number of pass/fail/etc jobs in each
+# flight.
+sub gather_stats($) {
+ my ($f) = @_;
+
+ my $stats= $dbh_tests->selectall_arrayref(<<END);
+ SELECT status,COUNT(*) FROM jobs
+ WHERE flight=$f->{Nr}
+ GROUP BY status
+END
+ for my $row (@{$stats}) {
+ my ($stat,$count) = @$row;
+ $f->{Stats}{lc($stat)} = $count;
+ $global_stats{lc($stat)} += $count;
+ }
+}
+
+sub sort_stats($) {
+ my ($stats) = @_;
+ my %so = (
+ queued => 1,
+ preparing => 2,
+ blocked => 3,
+ running => 4,
+ pass => 5,
+ fail => 6,
+ broken => 7,
+ );
+ return sort { ($so{$a}//0) <=> ($so{$b}//0) } (keys %{$stats});
+}
+
+sub add_event($$$$$) {
+ my ($job,$reso,$type,$info,$time) = @_;
+
+ die unless $type =~ m/^(Start|End)/;
+
+ $job->{OverallTime} //= {};
+
+ $job->{Reso}{$reso} //= {};
+ $job->{Reso}{$reso}{$type} = $time;
+
+ if ($type eq "Start") {
+ die if $job->{Reso}{$reso}{Info};
+ $job->{Reso}{$reso}{Info} = $info;
+ } else {
+ die if $job->{Reso}{$reso}{Info} ne $info;
+ }
+
+ my $cmp = $type eq "Start" ?
+ sub { $_[0] < $_[1] ? $_[0] : $_[1] } :
+ sub { $_[0] > $_[1] ? $_[0] : $_[1] };
+
+ $job->{OverallTime}{$type} //= $time;
+
+ $job->{OverallTime}{$type} =
+ $cmp->($time, $job->{OverallTime}{$type});
+}
+
+# Longest common prefix. First argument is cumulative over several
+# iterations and therefore we simply shorten it until it is a common
+# prefix of the second.
+sub update_lcp ($$) {
+ my ($a,$b) = @_;
+
+ return $b unless $a;
+ return $a unless $b;
+
+ chop $a while $b !~ m/^\Q$a\E/;
+ return $a;
+}
+
+# Walk all events in the plan and update the corresponding flight/job
+# with the timespan. Events relating to unknown jobs are added to
+# %anon_jobs.
+sub gather_events() {
+ while (my ($reso,$evts) = each %{ $plan->{Events} }) {
+ foreach my $evt ( @{$evts} ) {
+ my ($f,$job);
+ next unless $evt->{Type} =~ m/^(Start|End)$/;
+ if ( $evt->{Job} ) {
+ my ($fnum,$j);
+ $evt->{Job} =~ m/^([0-9]+)\.(.*)/ or die;
+ ($fnum,$j) = ($1,$2);
+ goto anon unless $flights{$fnum};
+ $f = $flights{$fnum};
+ goto anon unless $f->{Jobs}{$j};
+ $job = $f->{Jobs}{$j};
+ } else {
+ anon:
+ # Fake up a name from the $reso and the event's info
+ # field (if available).
+ my $anon_job = join(" ", ($reso,$evt->{Info}));
+ $anon_jobs{$anon_job} //= { Reso => {}, Anon => 1 };
+ $job = $anon_jobs{$anon_job};
+ }
+
+ my $time = $evt->{Time};
+
+ add_event($job, $reso, $evt->{Type}, $evt->{Info}, $time);
+
+ $f->{Info} = update_lcp($f->{Info}, $evt->{Info}) if $f;
+
+ if ($f && $evt->{Type} eq "End") {
+ $f->{ExpectedEnd} =
+ $time > $f->{ExpectedEnd} ?
+ $time : $f->{ExpectedEnd};
+ }
+ }
+ }
+}
+
+############
+
+my @cols = ("Job", "Status", "Resource", "Scheduled");
+
+sub fmttime($)
+{
+ my ($t) = @_;
+ return "Unknown" if !$t;
+ return strftime("%Y-%b-%d %a %H:%M:%S", gmtime $t);
+}
+
+sub fmt_timespan($) {
+ my ($s) = @_;
+
+ return undef unless $s;
+
+ if ( $s->{Start} || $s->{End} ) {
+ return join(" — ",
+ map { encode_entities(fmttime($s->{$_})) }
+ qw(Start End));
+ } else {
+ return "???";
+ }
+}
+
+sub currently_running($) {
+ my ($info) = @_;
+
+ return 0 unless $info->{OverallTime}{Start};
+ return 0 unless $info->{OverallTime}{End};
+
+ return 0 if $info->{OverallTime}{Start} > $plan->{Start};
+ return 0 if $info->{OverallTime}{End} < $plan->{Start};
+
+ return 1;
+}
+
+sub cols_hdr() {
+ printf("<tr bgcolor=#808080>\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>\n", scalar @cols);
+}
+
+sub cell($;$$) {
+ my ($text,$colourattr,$tag) = @_;
+ $text //= '';
+ $colourattr = $colourattr ? $colourattr : '';
+ $text = "<$tag>$text</$tag>" if $tag;
+ printf(" <td valign=top $colourattr>$text</td>\n");
+}
+
+sub do_one_job($$$$) {
+ my ($alt,$fl,$job,$info) = @_;
+ my $status = $info->{Status}//'';
+
+ my $bgcolour = report_altcolour(${$alt});
+
+ my @resos = sort keys %{ $info->{Reso} };
+
+ my ($resos,$spans);
+ my $resopfx = '';
+ if (@resos > 1) {
+ $resos = "Overall<br>\n ";
+ $resopfx = "— ";
+ $spans = fmt_timespan($info->{OverallTime})."<br>\n ";
+ }
+
+ $resos .= join "<br>\n ", map { "$resopfx$_" } @resos;
+ $spans .= join "<br>\n ", map { fmt_timespan($info->{Reso}{$_}) } @resos;
+
+ print "<tr $bgcolour>\n";
+
+ my $tag = $status eq "running" ? "b" : undef;
+
+ $tag = "b" if $info->{Anon} && currently_running($info);
+
+ cell(encode_entities($job), undef, $tag);
+
+ # Anonymous/rogue jobs may not have a flight or status
+ if ($fl && $status) {
+ my $info = report_run_getinfo({flight=>$fl,
+ job=>$job,
+ status=>$status});
+ cell($info->{Content}, $info->{ColourAttr}, $tag);
+ } else {
+ cell("(unknown)","","");
+ }
+ cell($resos);
+ cell($spans);
+
+ print "</tr>\n";
+ ${$alt} ^= 1;
+}
+
+###########
+
+@ARGV == 1 or die "need a data.pl";
+
+# Required by parts of Osstest::Executive.
+open DEBUG, ">/dev/null";
+
+csreadconfig();
+
+get_current_plan($ARGV[0]);
+
+enumerate_flights();
+
+foreach my $f (keys %flights) {
+ enumerate_jobs($flights{$f});
+ gather_stats($flights{$f});
+}
+
+gather_events();
+
+printf("<p>Report at ".fmttime(time)." based on plan at ".fmttime($plan->{Start})."</p>\n");
+printf("<p>%d flight(s) consisting of %s job(s)<br />%s<br />%s anonymous/rogue job(s)</p>\n",
+ scalar keys %flights, $tot_jobs,
+ join(" + ", map { "$global_stats{$_} $_" } (sort_stats(\%global_stats))),
+ scalar keys %anon_jobs);
+
+printf("<table border='0' cellspacing='0' rules=all>\n");
+
+foreach my $f (sort keys %flights) {
+ my $fi = $flights{$f};
+ my $alt = 0;
+
+ my $nrjobs = keys %{$fi->{Jobs}};
+ my $notqueued = $nrjobs - ($fi->{Stats}{queued}//0);
+
+ printf ("<tr><td colspan=%d>\n <table>\n", scalar @cols);
+ print (" <tr><td> </td></tr>\n");
+ flight_hdr("Flight: $f [$fi->{Branch} $fi->{Intended}]");
+ flight_hdr("Common info (active jobs only): $fi->{Info}") if $fi->{Info};
+ flight_hdr("Started: ".fmttime($fi->{Started}));
+ flight_hdr("Current phase ($notqueued/$nrjobs jobs) expected end: ".fmttime($fi->{ExpectedEnd}));
+ flight_hdr("Jobs: ".scalar (keys %{$fi->{Jobs}})." = ".
+ join(" + ", map { "$fi->{Stats}{$_} $_" } (sort_stats(\%{$fi->{Stats}})))
+ );
+ print (" </table>\n</td></tr>\n");
+
+ cols_hdr();
+
+ do_one_job(\$alt,$fi->{Nr},$_, $fi->{Jobs}{$_})
+ foreach sort { $a cmp $b } keys %{$fi->{Jobs}};
+}
+print "\n";
+
+printf ("<tr><td colspan=%d>\n <table>\n", scalar @cols);
+print (" <tr><td> </td></tr>\n");
+flight_hdr("Anonymous/Rogue Jobs");
+print (" </table>\n</td></tr>\n");
+cols_hdr();
+my $alt = 0;
+foreach my $j (sort keys %anon_jobs) {
+ do_one_job(\$alt,undef,$j, $anon_jobs{$j});
+}
+
+print "</table>\n";
--
2.5.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights
2015-09-16 13:07 [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights Ian Campbell
@ 2015-09-17 16:14 ` Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 1/4] ms-queuedaemon: report-plan: Use rename-into-place for data-*.final.pl Ian Campbell
` (3 more replies)
2015-09-18 9:02 ` [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights Ian Campbell
1 sibling, 4 replies; 14+ messages in thread
From: Ian Campbell @ 2015-09-17 16:14 UTC (permalink / raw)
To: ian.jackson, xen-devel
On Wed, 2015-09-16 at 14:07 +0100, Ian Campbell wrote:
> TODO: Hook up to ms-queuedaemon to run when a new projection is
> complete.
I will followup to this with 4 patches (including 2 from you) which do
this.
They are currently live in the Cambridge daemons-testing.git and
successfully producing http://osstest.xs.citrite.net/~osstest/summary.html
Ian.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH OSSTEST 1/4] ms-queuedaemon: report-plan: Use rename-into-place for data-*.final.pl
2015-09-17 16:14 ` Ian Campbell
@ 2015-09-17 16:14 ` Ian Campbell
2015-09-17 16:47 ` Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 2/4] ms-queuedaemon: Break out catching-internally Ian Campbell
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Ian Campbell @ 2015-09-17 16:14 UTC (permalink / raw)
To: ian.jackson, xen-devel; +Cc: Ian Jackson
From: Ian Jackson <ian.jackson@eu.citrix.com>
This means that data-projection.final.pl is never a half-written file.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
ms-queuedaemon | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ms-queuedaemon b/ms-queuedaemon
index 98cf5c1..1a31284 100755
--- a/ms-queuedaemon
+++ b/ms-queuedaemon
@@ -294,7 +294,9 @@ proc report-plan {w wo} {
} emsg]} {
log "INTERNAL ERROR showing $w html: $emsg"
} else {
- file copy -force data-$w.pl data-$wo.final.pl
+ set out data-$wo.final.pl
+ file copy -force data-$w.pl $out.new
+ file rename -force $out.new $out
log "$w report-plan OK"
}
}
--
2.5.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH OSSTEST 2/4] ms-queuedaemon: Break out catching-internally
2015-09-17 16:14 ` Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 1/4] ms-queuedaemon: report-plan: Use rename-into-place for data-*.final.pl Ian Campbell
@ 2015-09-17 16:14 ` Ian Campbell
2015-09-17 16:47 ` Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 3/4] ms-queuedaemon: Add report-projection Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 4/4] ms-queuedaemon: Call ms-flights-summary upon completed plan/projection Ian Campbell
3 siblings, 1 reply; 14+ messages in thread
From: Ian Campbell @ 2015-09-17 16:14 UTC (permalink / raw)
To: ian.jackson, xen-devel; +Cc: Ian Jackson
From: Ian Jackson <ian.jackson@eu.citrix.com>
No functional change.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
ms-queuedaemon | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/ms-queuedaemon b/ms-queuedaemon
index 1a31284..f3f85bd 100755
--- a/ms-queuedaemon
+++ b/ms-queuedaemon
@@ -39,6 +39,16 @@ proc foreach-walker {walkervar body} {
}
}
+proc catching-internally {what try {ifok {}}} {
+ if {[catch {
+ uplevel 1 $try
+ } emsg]} {
+ log "INTERNAL ERROR $what: $emsg"
+ } else {
+ uplevel 1 $ifok
+ }
+}
+
proc chan-destroy-stuff {chan} {
dequeue-chan $chan destroy
upvar #0 chan-info/$chan info
@@ -288,12 +298,10 @@ proc queuerun-perhaps-step {w} {
proc report-plan {w wo} {
global c
- if {[catch {
+ catching-internally "showing $w html" {
set outputfile "$c(WebspaceFile)/resource-$wo.html"
exec ./ms-planner -w$w show-html > $outputfile
- } emsg]} {
- log "INTERNAL ERROR showing $w html: $emsg"
- } else {
+ } {
set out data-$wo.final.pl
file copy -force data-$w.pl $out.new
file rename -force $out.new $out
@@ -486,10 +494,8 @@ proc restarter-restart-now {} {
log-event "restarter-restart-now projection-running"
}
- if {[catch {
+ catching-internally "setting unprocessed" {
chans-note-unprocessed plan [set plan/queue_running]
- } emsg]} {
- log "INTERNAL ERROR setting unprocessed: $emsg"
}
report-plan plan plan
--
2.5.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH OSSTEST 3/4] ms-queuedaemon: Add report-projection
2015-09-17 16:14 ` Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 1/4] ms-queuedaemon: report-plan: Use rename-into-place for data-*.final.pl Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 2/4] ms-queuedaemon: Break out catching-internally Ian Campbell
@ 2015-09-17 16:14 ` Ian Campbell
2015-09-17 16:33 ` Ian Jackson
2015-09-17 16:14 ` [PATCH OSSTEST 4/4] ms-queuedaemon: Call ms-flights-summary upon completed plan/projection Ian Campbell
3 siblings, 1 reply; 14+ messages in thread
From: Ian Campbell @ 2015-09-17 16:14 UTC (permalink / raw)
To: ian.jackson, xen-devel; +Cc: Ian Campbell
No semantic change. Eventually more tasks will be added which are
wanted in report-projection but not report-plan.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
ms-queuedaemon | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/ms-queuedaemon b/ms-queuedaemon
index f3f85bd..9c7645d 100755
--- a/ms-queuedaemon
+++ b/ms-queuedaemon
@@ -187,12 +187,12 @@ proc runneeded-perhaps-start {} {
proc queuerun-finished/plan {} {
runneeded-ensure-will 0
report-plan plan plan
- report-plan plan projection
+ report-projection plan
}
proc queuerun-finished/projection {} {
runneeded-ensure-will 0
- report-plan projection projection
+ report-projection projection
}
proc runneeded-ensure-polling {} {
@@ -309,6 +309,10 @@ proc report-plan {w wo} {
}
}
+proc report-projection {w} {
+ report-plan $w projection
+}
+
proc we-are-thinking {chan} {
set ws {}
foreach-walker w {
--
2.5.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH OSSTEST 3/4] ms-queuedaemon: Add report-projection
2015-09-17 16:14 ` [PATCH OSSTEST 3/4] ms-queuedaemon: Add report-projection Ian Campbell
@ 2015-09-17 16:33 ` Ian Jackson
2015-09-17 16:39 ` Ian Campbell
0 siblings, 1 reply; 14+ messages in thread
From: Ian Jackson @ 2015-09-17 16:33 UTC (permalink / raw)
To: Ian Campbell; +Cc: xen-devel
Ian Campbell writes ("[PATCH OSSTEST 3/4] ms-queuedaemon: Add report-projection"):
> No semantic change. Eventually more tasks will be added which are
> wanted in report-projection but not report-plan.
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Though you might want to avoid the word `task'. How about `Eventually
more work will be done ...' ?
Ian.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH OSSTEST 3/4] ms-queuedaemon: Add report-projection
2015-09-17 16:33 ` Ian Jackson
@ 2015-09-17 16:39 ` Ian Campbell
0 siblings, 0 replies; 14+ messages in thread
From: Ian Campbell @ 2015-09-17 16:39 UTC (permalink / raw)
To: Ian Jackson; +Cc: xen-devel
On Thu, 2015-09-17 at 17:33 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH OSSTEST 3/4] ms-queuedaemon: Add report
> -projection"):
> > No semantic change. Eventually more tasks will be added which are
> > wanted in report-projection but not report-plan.
>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Which reminds me, I meant to ack the first 2 before posting.
> Though you might want to avoid the word `task'. How about `Eventually
> more work will be done ...' ?
Sure.
Ian.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH OSSTEST 4/4] ms-queuedaemon: Call ms-flights-summary upon completed plan/projection
2015-09-17 16:14 ` Ian Campbell
` (2 preceding siblings ...)
2015-09-17 16:14 ` [PATCH OSSTEST 3/4] ms-queuedaemon: Add report-projection Ian Campbell
@ 2015-09-17 16:14 ` Ian Campbell
2015-09-17 16:34 ` Ian Jackson
3 siblings, 1 reply; 14+ messages in thread
From: Ian Campbell @ 2015-09-17 16:14 UTC (permalink / raw)
To: ian.jackson, xen-devel; +Cc: Ian Campbell
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
ms-queuedaemon | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/ms-queuedaemon b/ms-queuedaemon
index 9c7645d..6ae9677 100755
--- a/ms-queuedaemon
+++ b/ms-queuedaemon
@@ -310,7 +310,20 @@ proc report-plan {w wo} {
}
proc report-projection {w} {
+ global c
+
report-plan $w projection
+
+ # report-plan will have ensured data-projection.final.pl is up to
+ # date
+
+ catching-internally "producing summary" {
+ set proj "data-projection.final.pl"
+ set outputfile "$c(WebspaceFile)/summary.html"
+ exec ./ms-flights-summary $proj > $outputfile
+ } {
+ log "$w report-projection OK"
+ }
}
proc we-are-thinking {chan} {
--
2.5.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights
2015-09-16 13:07 [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights Ian Campbell
2015-09-17 16:14 ` Ian Campbell
@ 2015-09-18 9:02 ` Ian Campbell
2015-09-18 10:27 ` Ian Campbell
1 sibling, 1 reply; 14+ messages in thread
From: Ian Campbell @ 2015-09-18 9:02 UTC (permalink / raw)
To: ian.jackson, xen-devel
[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]
On Wed, 2015-09-16 at 14:07 +0100, Ian Campbell wrote:
> [...]
> +sub add_event($$$$$) {
> + my ($job,$reso,$type,$info,$time) = @_;
> +
> + die unless $type =~ m/^(Start|End)/;
> +
> + $job->{OverallTime} //= {};
> +
> + $job->{Reso}{$reso} //= {};
> + $job->{Reso}{$reso}{$type} = $time;
> +
> + if ($type eq "Start") {
> + die if $job->{Reso}{$reso}{Info};
This is attempting to check for conflicting events.
However in the case of sharing hosts as noted in the commit message there
is a gotcha which is that while the host is being prepared by one job the
rest appears as rogue/anonymous jobs (with Info==(preparing), FWIW) and
I've just observed this happen because 2 of those had the same start time
(which I suppose will be quite common?).
The attached plan shows this for the sharing of 'host grain-weevil' for
"build-wheezy-i386 e1adb8b552dda5c653958083c9c7457f0398ad09" purposes.
Anonymous jobs use $reso + $info as their (faked) job name, so they end up
clashing here.
I did the below as a quick fix, now I'm wondering if perhaps I should
suffix the faked up job name of these anon jobs with something unique from
either $evt->{Share} or $evt->{Allocated}.
->{Allocated}{Shareix} looks promising. What do you think?
The other option would be to arrange somehow for these jobs to have their
correct ->{Job} while in this state. Once the host is prepared and they are
running it comes back, so it must be available somewhere. I looked at the
planner and couldn't figure out where this was or ow to propagate it to
these anonymous jobs...
Ian.
@@ -153,7 +153,8 @@ sub add_event($$$$$) {
$job->{Reso}{$reso}{$type} = $time;
if ($type eq "Start") {
- die if $job->{Reso}{$reso}{Info};
+ die "$job $reso $job->{Reso}{$reso}{Info}"
+ if ($job->{Reso}{$reso}{Info}//$info) ne $info;
$job->{Reso}{$reso}{Info} = $info;
} else {
[-- Attachment #2: data-projection.final.pl --]
[-- Type: application/x-perl, Size: 147593 bytes --]
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights
2015-09-18 9:02 ` [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights Ian Campbell
@ 2015-09-18 10:27 ` Ian Campbell
2015-09-18 11:14 ` Ian Campbell
0 siblings, 1 reply; 14+ messages in thread
From: Ian Campbell @ 2015-09-18 10:27 UTC (permalink / raw)
To: ian.jackson, xen-devel
On Fri, 2015-09-18 at 10:02 +0100, Ian Campbell wrote:
> On Wed, 2015-09-16 at 14:07 +0100, Ian Campbell wrote:
> > [...]
> > +sub add_event($$$$$) {
> > + my ($job,$reso,$type,$info,$time) = @_;
> > +
> > + die unless $type =~ m/^(Start|End)/;
> > +
> > + $job->{OverallTime} //= {};
> > +
> > + $job->{Reso}{$reso} //= {};
> > + $job->{Reso}{$reso}{$type} = $time;
> > +
> > + if ($type eq "Start") {
> > + die if $job->{Reso}{$reso}{Info};
>
> This is attempting to check for conflicting events.
>
> However in the case of sharing hosts as noted in the commit message there
> is a gotcha which is that while the host is being prepared by one job the
> rest appears as rogue/anonymous jobs (with Info==(preparing), FWIW) and
> I've just observed this happen because 2 of those had the same start time
> (which I suppose will be quite common?).
>
> The attached plan shows this for the sharing of 'host grain-weevil' for
> "build-wheezy-i386 e1adb8b552dda5c653958083c9c7457f0398ad09" purposes.
>
> Anonymous jobs use $reso + $info as their (faked) job name, so they end
> up
> clashing here.
>
> I did the below as a quick fix, now I'm wondering if perhaps I should
> suffix the faked up job name of these anon jobs with something unique
> from
> either $evt->{Share} or $evt->{Allocated}.
>
> ->{Allocated}{Shareix} looks promising. What do you think?
This would be the following. So far I think this is the best option.
diff --git a/ms-flights-summary b/ms-flights-summary
index 60b6b88..24eb844 100755
--- a/ms-flights-summary
+++ b/ms-flights-summary
@@ -153,7 +153,8 @@ sub add_event($$$$$) {
$job->{Reso}{$reso}{$type} = $time;
if ($type eq "Start") {
- die if $job->{Reso}{$reso}{Info};
+ die "$reso $job->{Reso}{$reso}{Info}"
+ if $job->{Reso}{$reso}{Info};
$job->{Reso}{$reso}{Info} = $info;
} else {
die if $job->{Reso}{$reso}{Info} ne $info;
@@ -203,6 +204,9 @@ sub gather_events() {
# Fake up a name from the $reso and the event's info
# field (if available).
my $anon_job = join(" ", ($reso,$evt->{Info}));
+ $anon_job .= " (shared $evt->{Allocated}{Shareix})"
+ if $evt->{Allocated};
+
$anon_jobs{$anon_job} //= { Reso => {}, Anon => 1 };
$job = $anon_jobs{$anon_job};
}
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights
2015-09-18 10:27 ` Ian Campbell
@ 2015-09-18 11:14 ` Ian Campbell
0 siblings, 0 replies; 14+ messages in thread
From: Ian Campbell @ 2015-09-18 11:14 UTC (permalink / raw)
To: ian.jackson, xen-devel
On Fri, 2015-09-18 at 11:27 +0100, Ian Campbell wrote:
> On Fri, 2015-09-18 at 10:02 +0100, Ian Campbell wrote:
> > On Wed, 2015-09-16 at 14:07 +0100, Ian Campbell wrote:
> > > [...]
> > > +sub add_event($$$$$) {
> > > + my ($job,$reso,$type,$info,$time) = @_;
> > > +
> > > + die unless $type =~ m/^(Start|End)/;
> > > +
> > > + $job->{OverallTime} //= {};
> > > +
> > > + $job->{Reso}{$reso} //= {};
> > > + $job->{Reso}{$reso}{$type} = $time;
> > > +
> > > + if ($type eq "Start") {
> > > + die if $job->{Reso}{$reso}{Info};
> >
> > This is attempting to check for conflicting events.
> >
> > However in the case of sharing hosts as noted in the commit message
> > there
> > is a gotcha which is that while the host is being prepared by one job
> > the
> > rest appears as rogue/anonymous jobs (with Info==(preparing), FWIW) and
> > I've just observed this happen because 2 of those had the same start
> > time
> > (which I suppose will be quite common?).
> >
> > The attached plan shows this for the sharing of 'host grain-weevil' for
> > "build-wheezy-i386 e1adb8b552dda5c653958083c9c7457f0398ad09" purposes.
> >
> > Anonymous jobs use $reso + $info as their (faked) job name, so they end
> > up
> > clashing here.
> >
> > I did the below as a quick fix, now I'm wondering if perhaps I should
> > suffix the faked up job name of these anon jobs with something unique
> > from
> > either $evt->{Share} or $evt->{Allocated}.
> >
> > ->{Allocated}{Shareix} looks promising. What do you think?
>
> This would be the following. So far I think this is the best option.
We discussed this IRL and it turns out for these sorts of "clashing" shares
the start and end should always be the same, and while ms-flights-summary
could check this it's not really its responsibility to do so (and that
failing to produce any output at all under these circumstances is totally
suboptimal).
Therefore I've dropped the sanity checks, as below. If ms-planner were to
go mad then there might be some anomalous looking rogue jobs in the table,
which is fine.
I'm also going to colourise the "Scheduled" column to indicate more clearly
when something is running right now.
Ian.
diff --git a/ms-flights-summary b/ms-flights-summary
index 964ca18..ba51eaa 100755
--- a/ms-flights-summary
+++ b/ms-flights-summary
@@ -152,13 +152,8 @@ sub add_event($$$$$) {
$job->{Reso}{$reso} //= {};
$job->{Reso}{$reso}{$type} = $time;
- if ($type eq "Start") {
- die "$job $reso $job->{Reso}{$reso}{Info}"
- if ($job->{Reso}{$reso}{Info}//$info) ne $info;
- $job->{Reso}{$reso}{Info} = $info;
- } else {
- die if $job->{Reso}{$reso}{Info} ne $info;
- }
+ $job->{Reso}{$reso}{Info} = $info
+ if $type eq "Start";
my $cmp = $type eq "Start" ?
sub { $_[0] < $_[1] ? $_[0] : $_[1] } :
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-09-18 11:14 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16 13:07 [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights Ian Campbell
2015-09-17 16:14 ` Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 1/4] ms-queuedaemon: report-plan: Use rename-into-place for data-*.final.pl Ian Campbell
2015-09-17 16:47 ` Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 2/4] ms-queuedaemon: Break out catching-internally Ian Campbell
2015-09-17 16:47 ` Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 3/4] ms-queuedaemon: Add report-projection Ian Campbell
2015-09-17 16:33 ` Ian Jackson
2015-09-17 16:39 ` Ian Campbell
2015-09-17 16:14 ` [PATCH OSSTEST 4/4] ms-queuedaemon: Call ms-flights-summary upon completed plan/projection Ian Campbell
2015-09-17 16:34 ` Ian Jackson
2015-09-18 9:02 ` [PATCH OSSTEST v4] ms-flights-summary: Produce an HTML report of all active flights Ian Campbell
2015-09-18 10:27 ` Ian Campbell
2015-09-18 11:14 ` Ian Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).