[IMP] runbot: serealisation imps

Trying to log when the transaction is in error is useless and create
noise in the logs.

Flushing is also useless there now that we have the local logs,
and it makes the error confusing since the error does not come from the
log_counter update but from the update of the global state on the
parents global_results.
This commit is contained in:
Xavier-Do 2022-11-29 12:08:28 +01:00 committed by Christophe Monniez
parent 937747caec
commit 0e14e6d922

View File

@ -19,6 +19,7 @@ from odoo.tools.safe_eval import safe_eval
from collections import defaultdict
from pathlib import Path
from psycopg2 import sql
from psycopg2.extensions import TransactionRollbackError
import getpass
_logger = logging.getLogger(__name__)
@ -704,7 +705,7 @@ class BuildResult(models.Model):
build._log('_schedule', 'Docker with state %s not started after 60 seconds, skipping' % _docker_state, level='ERROR')
if hosts_by_build[build.id]._fetch_local_logs(build_ids=build.ids):
continue # avoid to make results with remaining logs
# No job running, make result and select nex job
# No job running, make result and select next job
build_values = {
'job_end': now(),
'docker_start': False,
@ -730,6 +731,7 @@ class BuildResult(models.Model):
build_values.update(build._next_job_values()) # find next active_step or set to done
ending_build = build.local_state not in ('done', 'running') and build_values.get('local_state') in ('done', 'running')
if ending_build:
build.update_build_end()
@ -752,6 +754,8 @@ class BuildResult(models.Model):
os.makedirs(build._path('datadir'), exist_ok=True)
try:
build.active_step._run(build) # run should be on build?
except TransactionRollbackError:
raise
except Exception as e:
if isinstance(e, RunbotException):
message = e.args[0]