From aad64cad80b040601e0b9fef9935b29cbc5fb2a5 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Wed, 11 Feb 2015 17:10:48 +0100 Subject: [PATCH] add some debug logs --- runbot/runbot.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runbot/runbot.py b/runbot/runbot.py index 17d491dd..c502a727 100644 --- a/runbot/runbot.py +++ b/runbot/runbot.py @@ -145,7 +145,7 @@ def uniq_list(l): return OrderedDict.fromkeys(l).keys() def fqdn(): - return socket.gethostname() + return socket.getfqdn() #---------------------------------------------------------- # RunBot Models @@ -315,7 +315,7 @@ def scheduler(self, cr, uid, ids=None, context=None): workers = int(icp.get_param(cr, uid, 'runbot.workers', default=6)) running_max = int(icp.get_param(cr, uid, 'runbot.running_max', default=75)) host = fqdn() - + _logger.debug('in scheduler %s', ids) Build = self.pool['runbot.build'] domain = [('repo_id', 'in', ids)] domain_host = domain + [('host', '=', host)] @@ -327,8 +327,8 @@ def scheduler(self, cr, uid, ids=None, context=None): # launch new tests testing = Build.search_count(cr, uid, domain_host + [('state', '=', 'testing')]) pending = Build.search_count(cr, uid, domain + [('state', '=', 'pending')]) - while testing < workers and pending > 0: + _logger.debug('scheduler: testing: %d, workers: %d, pending: %d', testing, workers, pending) # find sticky pending build if any, otherwise, last pending (by id, not by sequence) will do the job pending_ids = Build.search(cr, uid, domain + [('state', '=', 'pending'), ('branch_id.sticky', '=', True)], limit=1) @@ -341,6 +341,7 @@ def scheduler(self, cr, uid, ids=None, context=None): # compute the number of testing and pending jobs again testing = Build.search_count(cr, uid, domain_host + [('state', '=', 'testing')]) pending = Build.search_count(cr, uid, domain + [('state', '=', 'pending')]) + _logger.debug('scheduler full: testing: %d, workers: %d, pending: %d', testing, workers, pending) # terminate and reap doomed build build_ids = Build.search(cr, uid, domain_host + [('state', '=', 'running')]) @@ -870,6 +871,7 @@ def schedule(self, cr, uid, ids, context=None): timeout = int(icp.get_param(cr, uid, 'runbot.timeout', default=1800)) for build in self.browse(cr, uid, ids, context=context): + _logger.debug('schedule build %r state %s', build.dest, build.state) if build.state == 'pending': # allocate port and schedule first job port = self.find_port(cr, uid)