From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>, Wei Liu <wei.liu2@citrix.com>
Subject: [OSSTEST PATCH 4/7] duration_estimator: Be able to estimate job duration up to a particular step
Date: Thu, 11 Aug 2016 17:18:00 +0100 [thread overview]
Message-ID: <1470932283-17445-5-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1470932283-17445-1-git-send-email-ian.jackson@eu.citrix.com>
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@eu.citrix.com>
---
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@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-08-11 16:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 16:17 [OSSTEST PATCH 0/7] Apropos of XTF: Improve failed step selection Ian Jackson
2016-08-11 16:17 ` [OSSTEST PATCH 1/7] duration_estimator: Introduce $duration_duration_qtxt and @d_d_args Ian Jackson
2016-08-11 16:17 ` [OSSTEST PATCH 2/7] duration_estimator: Reformat inner SQL query with more newlines Ian Jackson
2016-08-11 16:17 ` [OSSTEST PATCH 3/7] duration_estimator: Reorganise inner SQL query to use WITH Ian Jackson
2016-08-11 16:18 ` Ian Jackson [this message]
2016-08-11 16:18 ` [OSSTEST PATCH 5/7] sg-report-flight: Fix misleading value in call to duration_estimator Ian Jackson
2016-08-11 16:18 ` [OSSTEST PATCH 6/7] sg-report-flight: Fix a missing newline in a DEBUG message Ian Jackson
2016-08-11 16:18 ` [OSSTEST PATCH 7/7] sg-report-flight: Report earlier, earlier step failures Ian Jackson
2016-08-11 17:05 ` [OSSTEST PATCH 0/7] Apropos of XTF: Improve failed step selection Wei Liu
2016-08-30 16:00 ` Wei Liu
2016-08-30 16:08 ` Ian Jackson
2016-08-30 16:13 ` Andrew Cooper
2016-09-05 18:08 ` Wei Liu
2016-09-06 9:45 ` Ian Jackson
2016-09-06 9:46 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470932283-17445-5-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).