END
$anypassq= db_prepare($anypassq);
- my $duration_estimator= duration_estimator($branch, $blessings[0]);
+ my $duration_estimator=
+ duration_estimator($branch, $blessings[0], undef, 1);
foreach my $failv (@failures) {
- my ($est) = $duration_estimator->($failv->{Job}{job},'',undef);
+ my ($est) = $duration_estimator->($failv->{Job}{job},'',undef,
+ $failv->{Step}{testid});
if (!defined $est) { $est = 1e5; }
print DEBUG "DE $failv->{Job}{job} $est\n";
$failv->{DurationEstimate}= $est;
}
- @failures= sort { $a->{DurationEstimate} <=> $b->{DurationEstimate} }
+ @failures= sort {
+ $a->{DurationEstimate} <=> $b->{DurationEstimate}
+ or $a->{Step}{stepno} <=> $b->{Step}{stepno}
+ # stepno is sequential only within each job, so strictly
+ # speaking this is not really a valid comparison: we will
+ # usually be comparing failed steps in different jobs. But
+ # this comparison is a backstup, secondary to the duration
+ # estimate; and it does mean that if the two failures are
+ # different steps of the same job, and they ran fast so that
+ # they finished in the same second, we pick the lower-numbered
+ # step, which is the earlier one (if they are sequential at
+ # all).
+ }
@failures;
my @heisenflights;