mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 05:15:45 +07:00
[FIX] runbot: docker cleanup should be run on workers only
This commit is contained in:
parent
ecd718ca2a
commit
7f4f82a881
@ -544,14 +544,6 @@ class runbot_repo(models.Model):
|
|||||||
if hostname != fqdn():
|
if hostname != fqdn():
|
||||||
return 'Not for me'
|
return 'Not for me'
|
||||||
|
|
||||||
# docker cleanup
|
|
||||||
containers = {int(dc.split('-', 1)[0]):dc for dc in docker_ps() if dest_reg.match(dc)}
|
|
||||||
if containers:
|
|
||||||
candidates = 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])
|
|
||||||
|
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
timeout = self._get_cron_period()
|
timeout = self._get_cron_period()
|
||||||
icp = self.env['ir.config_parameter']
|
icp = self.env['ir.config_parameter']
|
||||||
@ -584,6 +576,14 @@ class runbot_repo(models.Model):
|
|||||||
# -> Keep them as long as possible
|
# -> Keep them as long as possible
|
||||||
self.env['runbot.build']._local_cleanup()
|
self.env['runbot.build']._local_cleanup()
|
||||||
|
|
||||||
|
# 3. docker cleanup
|
||||||
|
containers = {int(dc.split('-', 1)[0]):dc for dc in docker_ps() 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])
|
||||||
|
|
||||||
timeout = self._get_cron_period()
|
timeout = self._get_cron_period()
|
||||||
icp = self.env['ir.config_parameter']
|
icp = self.env['ir.config_parameter']
|
||||||
update_frequency = int(icp.get_param('runbot.runbot_update_frequency', default=10))
|
update_frequency = int(icp.get_param('runbot.runbot_update_frequency', default=10))
|
||||||
|
Loading…
Reference in New Issue
Block a user