[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [OSSTEST] ms-planner: add a flight summary html report
Ian Campbell writes ("Re: [OSSTEST] ms-planner: add a flight summary html report"): > On Wed, 2014-04-30 at 16:44 +0100, Ian Jackson wrote: > > This is rather a layering violation. Info is for the consumption of > > humans. Perhaps the plan should have an explicit "flight.job" field. > > I was a bit more scared of touching the actual planner daemon... But ok. I think you can safely add new fields to the events, although the existing planner daemon probably won't propagate them. > > > + if ( $evt->{Time} > $flights{$flight}->{End} ) { > > > + $flights{$flight}->{Last} = $evt; > > > + $flights{$flight}->{LastReso} = $reso; > > > > You don't seem to use LastReso and I can't seem to see why you'd want > > it. > > I think I was just being a completest in case I decided I wanted it. Right. I think it's probably going to be tedious to define exactly what this ought to be so I would leave it out. > > > + foreach my $job (sort { $inf->{Jobs}{$a}->{Start}->{Time} cmp $\ > > inf->{Jobs}{$b}->{Start}->{Time} } keys %{ $inf->{Jobs} }) { > > > > You repeat the $inf->{Jobs}{$x}->{Start}->{Time} expression. Make it > > an anonymous subref or something and this will become much clearer. > > You mean like: > my $ta = sub { return $inf->{Jobs}{$a}->.... } > my $tb = sub { return $inf->{Jobs}{$b}->.... } > foreach ... (sort { $ta() cmp $tb() } keys ... ) { > > Or my $to = sub($) { my $it=shift; return $info-{Jobs}{$it}... } and > $to($a) ? The latter. (Or a http://en.wikipedia.org/wiki/Schwartzian_transform but that seems overkill.) Hrm, it turns out that some time in the last decade it became possible to write local lexical subroutines that aren't coderefs. So try sub sortkey { ... } just before the sort. > I should note that I realised after I wrote this patch that as jobs > complete others might appear, so you can't necessarily know when the > flight will end, although once the build jobs are done you can generally > get a pretty good idea. Indeed. The reader will have to know about that. > > How about > > foreach my $se (qw(Start End)) { > > ? > > OK. I never would have come up with that myself. Learn Common Lisp :-). > > > + 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" > > > > Repetition. > > I suppose I can probably figure out enough Tcl to avoid it... I was > being cowardly about making no-trivial mods ;-) Heh. Tcl, like Perl, is a nice language to abstract in. Thanks, Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |