[IMP] runbot: add some log

This commit is contained in:
Xavier-Do 2019-12-18 17:27:33 +01:00
parent 7606c03c35
commit 9ae816a23d
2 changed files with 3 additions and 1 deletions

View File

@ -748,13 +748,14 @@ class runbot_repo(models.Model):
pass
def _docker_cleanup(self):
_logger.info('Docker cleaning')
docker_ps_result = docker_ps()
containers = {int(dc.split('-', 1)[0]):dc for dc in docker_ps_result if dest_reg.match(dc)}
if containers:
candidates = self.env['runbot.build'].search([('id', 'in', list(containers.keys())), ('local_state', '=', 'done')])
for c in candidates:
_logger.info('container %s found running with build state done', containers[c.id])
docker_stop(containers[c.id])
docker_stop(containers[c.id], c._path())
ignored = {dc for dc in docker_ps_result if not dest_reg.match(dc)}
if ignored:
_logger.debug('docker (%s) not deleted because not dest format', " ".join(list(ignored)))

View File

@ -37,6 +37,7 @@ class RunbotClient():
self.env['runbot.build']._local_cleanup()
self.env['runbot.repo']._docker_cleanup()
host.set_psql_conn_count()
_logger.debug('Scheduling...')
count += 1
sleep_time = self.env['runbot.repo']._scheduler_loop_turn(host)
host.last_end_loop = fields.Datetime.now()