|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 4/7] duration_estimator: Be able to estimate job duration up to a particular step
If this is passed, we are interested only in the duration up to and
including the specified test step. (If the specified test step is not
present or didn't have a recorded finish, we look at the whole job.)
Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
Osstest/Executive.pm | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index 10fdc8d..7e31b35 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -1012,16 +1012,21 @@ END
#---------- duration estimator ----------
-sub duration_estimator ($$;$) {
- my ($branch, $blessing, $debug) = @_;
+sub duration_estimator ($$;$$) {
+ my ($branch, $blessing, $debug, $will_uptoincl_testid) = @_;
# returns a function which you call like this
- # $durest->($job, $hostidname, $onhost)
+ # $durest->($job, $hostidname, $onhost [, $uptoincl_testid])
# and returns one of
# ($seconds, $samehostlaststarttime, $samehostlaststatus)
# ($seconds, undef, undef)
# ()
# $debug should be something like sub { print DEBUG "@_\n"; }.
# Pass '' for $hostidname and $onhost for asking about on any host
+ #
+ # $uptincl_testid must be passed iff $will_uptoincl_testid, in
+ # which case the duration up to and including that step will be
+ # estimated (and only jobs which contained that step will be
+ # considered).
my $recentflights_q= $dbh_tests->prepare(<<END);
SELECT f.flight AS flight,
@@ -1068,11 +1073,20 @@ END
FROM tsteps
WHERE step != 'ts-hosts-allocate'
END
+
+ if ($will_uptoincl_testid) {
+ $duration_duration_qtxt .= <<END;
+ AND finished <=
+ (SELECT finished
+ FROM tsteps
+ WHERE tsteps.testid = ?)
+END
+ }
my $duration_duration_q = $dbh_tests->prepare($duration_duration_qtxt);
return sub {
- my ($job, $hostidname, $onhost) = @_;
+ my ($job, $hostidname, $onhost, $uptoincl_testid) = @_;
my $dbg= $debug ? sub {
$debug->("DUR $branch $blessing $job $hostidname $onhost @_");
@@ -1108,6 +1122,7 @@ END
my $duration_max= 0;
foreach my $ref (@$refs) {
my @d_d_args = ($ref->{flight}, $job);
+ push @d_d_args, $uptoincl_testid if $will_uptoincl_testid;
$duration_duration_q->execute(@d_d_args);
my ($duration) = $duration_duration_q->fetchrow_array();
$duration_duration_q->finish();
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |