[FIX] runbot: catch exceptions on wake-up

When a build is wake-up and something goes wrong during the
_run_odoo_run method, the "fetch and build" cron is broken and the
concerned runbot host stops working.

With this commit, the exception is catched and the build goes back to
the "done" state whith a log.
This commit is contained in:
Christophe Monniez 2019-08-22 12:40:46 +02:00 committed by Xavier-Do
parent 0da30a9f60
commit 8d199b4c16

View File

@ -555,10 +555,15 @@ class runbot_build(models.Model):
build.write({'requested_action': False, 'local_state': 'done'})
build._log('wake_up', 'Impossible to wake-up, build dir does not exists anymore', level='SEPARATOR')
else:
log_path = build._path('logs', 'wake_up.txt')
build.write({'job_start': now(), 'job_end': False, 'active_step': False, 'requested_action': False, 'local_state': 'running'})
build._log('wake_up', 'Waking up build', level='SEPARATOR')
self.env['runbot.build.config.step']._run_odoo_run(build, log_path)
try:
log_path = build._path('logs', 'wake_up.txt')
build.write({'job_start': now(), 'job_end': False, 'active_step': False, 'requested_action': False, 'local_state': 'running'})
build._log('wake_up', 'Waking up build', level='SEPARATOR')
self.env['runbot.build.config.step']._run_odoo_run(build, log_path)
except Exception:
_logger.exception('Failed to wake up build %s', build.dest)
build._log('_schedule', 'Failed waking up build')
build.write({'requested_action': False, 'local_state': 'done'})
continue
if build.local_state == 'pending':