[Libreoffice-commits] buildbot.git: 2 commits - tb3/tb3-local-client
Bjoern Michaelsen
bjoern.michaelsen at canonical.com
Mon Jul 29 16:21:04 PDT 2013
tb3/tb3-local-client | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
New commits:
commit db63f9d3e7ac56653884e94553d481d4206bfaa9
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Tue Jul 30 01:16:46 2013 +0200
proposal is only a dict here for now
diff --git a/tb3/tb3-local-client b/tb3/tb3-local-client
index 9335053..f2e02c7 100755
--- a/tb3/tb3-local-client
+++ b/tb3/tb3-local-client
@@ -95,7 +95,7 @@ class LocalClient:
self.tb3(repo=repo, sync=True)
proposals = [self.get_proposal(source) for source in self.sources]
for p in proposals:
- if p and (not proposal or p.score > proposal.score):
+ if p and (not proposal or p['score'] > proposal['score']):
proposal = p
if not proposal or float(proposal['score']) < self.args['min_score']:
time.sleep(self.args['poll_idle_time'])
commit 01af4fcf8a270725003f80f17cf3c05f64bc7c48
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Tue Jul 30 01:09:06 2013 +0200
track estimated duration in local-client
diff --git a/tb3/tb3-local-client b/tb3/tb3-local-client
index ec98060..9335053 100755
--- a/tb3/tb3-local-client
+++ b/tb3/tb3-local-client
@@ -7,6 +7,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
import argparse
+import datetime
import json
import os.path
import sh
@@ -39,6 +40,7 @@ class LocalClient:
format='json')
self.logdir = self.args['logdir']
self.workdir = tempfile.mkdtemp()
+ self.buildtimes = {}
def get_proposal(self, source):
data = ''
for line in self.tb3(repo=source.repo, branch=source.branch, platform=source.platform, show_proposals=True):
@@ -49,7 +51,11 @@ class LocalClient:
else:
return None
def report_start(self, proposal):
- self.tb3(repo=proposal['repo'], branch=proposal['branch'], platform=proposal['platform'], set_commit_running=proposal['commit'])
+ estimated_buildtime = float(120)
+ if self.buildtimes.has_key( (proposal['repo'], proposal['branch'], proposal['platform']) ):
+ scenario_buildtimes = self.buildtimes[ (proposal['repo'], proposal['branch'], proposal['platform']) ]
+ estimated_buildtime = scenario_buildtimes[len(scenario_buildtimes)/2]
+ self.tb3(repo=proposal['repo'], branch=proposal['branch'], platform=proposal['platform'], set_commit_running=proposal['commit'], estimated_buildtime=estimated_buildtime)
def run_build(self, proposal):
buildtime = int(time.time()*100)
if self.logdir:
@@ -57,6 +63,7 @@ class LocalClient:
else:
outfile = '/dev/null'
command = sh.Command(self.args['script'])
+ starttime = datetime.datetime.now()
rc = command(
proposal['commit'],
proposal['repo'],
@@ -66,6 +73,16 @@ class LocalClient:
_err=outfile,
_out=outfile,
_ok_code=range(256)).exit_code
+ duration_in_minutes = ((datetime.datetime.now() - starttime).total_seconds())/60
+ if self.buildtimes.has_key( (proposal['repo'], proposal['branch'], proposal['platform']) ):
+ scenario_buildtimes = self.buildtimes[ (proposal['repo'], proposal['branch'], proposal['platform']) ]
+ scenario_buildtimes.append(duration_in_minutes)
+ scenario_buildtimes = sorted(scenario_buildtimes)
+ if len(scenario_buildtimes) > 100:
+ scenario_buildtimes = scenario_buildtimes[1:-1]
+ self.buildtimes[ (proposal['repo'], proposal['branch'], proposal['platform']) ] = scenario_buildtimes
+ else:
+ self.buildtimes[ (proposal['repo'], proposal['branch'], proposal['platform']) ] = [duration_in_minutes]
if not rc:
return ('good', os.path.basename(outfile))
return ('bad', os.path.basename(outfile))
@@ -104,7 +121,6 @@ if __name__ == '__main__':
parser.add_argument('--builder', help='name of the build machine interacting with the coordinator', required=True)
parser.add_argument('--script', help='path to the build script', required=True)
parser.add_argument('--logdir', help='path to the to store the logs', default=None)
- parser.add_argument('--estimated-duration', help='the estimated time to complete in minutes (default: 120)', type=float, default=120.0)
parser.add_argument('--count', help='the number of builds to try, 0 for unlimited builds (default: unlimited)', type=int, default=0)
parser.add_argument('--poll-idle-time', help='the number seconds to wait before a retry when not getting a good proposal (default: 60)', type=float, default=60.0)
parser.add_argument('--min-score', help='the minimum score of a proposal to be tried (default: 0)', type=float, default=1.0)
More information about the Libreoffice-commits
mailing list