From be73b3b604f4892dc9ef8c30f2c233e64b763bea Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Tue, 7 Jul 2026 17:58:09 +0200 Subject: [PATCH 1/2] [IMP] runbot: allow to disable hosts selectively --- runbot/models/host.py | 8 ++++++++ runbot/views/host_views.xml | 25 ++++++++++++++++++++++++- runbot_builder/tools.py | 4 +++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/runbot/models/host.py b/runbot/models/host.py index 53c363473..fcccfc6b7 100644 --- a/runbot/models/host.py +++ b/runbot/models/host.py @@ -394,6 +394,14 @@ def _get_builds(self, domain, order=None): def _process_messages(self): return self.host_message_ids._process() + def _action_pause(self): + for host in self: + host.paused = True + + def _action_unpause(self): + for host in self: + host.paused = False + class MessageQueue(models.Model): _name = 'runbot.host.message' diff --git a/runbot/views/host_views.xml b/runbot/views/host_views.xml index 726aeff48..f24647aa2 100644 --- a/runbot/views/host_views.xml +++ b/runbot/views/host_views.xml @@ -63,7 +63,7 @@ - + @@ -75,5 +75,28 @@ host + + Pause Selected Hosts + + + ir.actions.server + code + + action = records._action_pause() + + + + + Unpause Selected Hosts + + + ir.actions.server + code + + action = records._action_unpause() + + + + diff --git a/runbot_builder/tools.py b/runbot_builder/tools.py index 4fd018fd0..0fc6fa57e 100644 --- a/runbot_builder/tools.py +++ b/runbot_builder/tools.py @@ -16,6 +16,7 @@ from pathlib import Path from logging.handlers import WatchedFileHandler + LOG_FORMAT = '%(asctime)s %(levelname)s %(name)s: %(message)s' logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) logging.getLogger('odoo.addons.runbot').setLevel(logging.DEBUG) @@ -40,6 +41,7 @@ def on_start(self): def main_loop(self): from odoo import fields from odoo.tools.profiler import Profiler + from odoo.tools.misc import str2bool self.on_start() signal.signal(signal.SIGINT, self.signal_handler) signal.signal(signal.SIGTERM, self.signal_handler) @@ -64,7 +66,7 @@ def main_loop(self): self.env.reset() self.env = self.env() self.count = self.count % self.max_count - if self.host.paused: + if self.host.paused or str2bool(self.env['ir.config_parameter'].sudo().get_param('pause_all_hosts', 'False')): sleep_time = 5 else: sleep_time = self.loop_turn() From 1b86a00200007aa8b574a4d3bc260641c441811e Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Wed, 8 Jul 2026 08:38:15 +0200 Subject: [PATCH 2/2] xdo --- runbot_builder/tools.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runbot_builder/tools.py b/runbot_builder/tools.py index 0fc6fa57e..9a1295405 100644 --- a/runbot_builder/tools.py +++ b/runbot_builder/tools.py @@ -57,6 +57,11 @@ def main_loop(self): ' (assigned only)' if self.host.assigned_only else '' ) while True: + if str2bool(self.env['ir.config_parameter'].sudo().get_param('pause_all_hosts', 'False')): + # don't even access hosts to make upgrades possible + _logger.info('All hosts are paused, sleeping 10s') + self.sleep(10) + continue context_manager = Profiler(db=self.env.cr.dbname) if self.host.profile else nullcontext() with context_manager: try: @@ -66,7 +71,7 @@ def main_loop(self): self.env.reset() self.env = self.env() self.count = self.count % self.max_count - if self.host.paused or str2bool(self.env['ir.config_parameter'].sudo().get_param('pause_all_hosts', 'False')): + if self.host.paused: sleep_time = 5 else: sleep_time = self.loop_turn()