mirror of
https://github.com/odoo/runbot.git
synced 2025-03-16 07:55:45 +07:00
[FIX] runbot: tempfix wait for docker mechanism
Docker can take some time to be considered as running after docker_run. This issue can appear when we speedup sheduling loop. To avoid that when can add an time condition to consider if a docker is running, but we want to avoid to wait to much since some jobs are fast. This solution check if a job is a docker run before waiting, and will also update job_start after a checkout since this can take some time if a git fetch is performed.
This commit is contained in:
parent
5bbfb06ce1
commit
46a7362d18
@ -595,7 +595,7 @@ class runbot_build(models.Model):
|
||||
build._log('_schedule', '%s time exceeded (%ss)' % (build.active_step.name if build.active_step else "?", build.job_time))
|
||||
build._kill(result='killed')
|
||||
continue
|
||||
elif build.job_time < 15:
|
||||
elif build.active_step._is_docker_step() and build.job_time < 15:
|
||||
_logger.debug('container "%s" seems too take a while to start', build._get_docker_name())
|
||||
continue
|
||||
# No job running, make result and select nex job
|
||||
|
@ -237,8 +237,17 @@ class ConfigStep(models.Model):
|
||||
}
|
||||
return safe_eval(self.sudo().python_code.strip(), eval_ctx, mode="exec", nocopy=True)
|
||||
|
||||
def _is_docker_step(self):
|
||||
if not self:
|
||||
return False
|
||||
self.ensure_one()
|
||||
return self.job_type in ('install_odoo', 'run_odoo') or (self.job_type == 'python' and 'docker_run(' in self.python_code)
|
||||
|
||||
def _run_odoo_run(self, build, log_path):
|
||||
exports = build._checkout()
|
||||
# update job_start AFTER checkout to avoid build being killed too soon if checkout took some time and docker take some time to start
|
||||
build.job_start = now()
|
||||
|
||||
# adjust job_end to record an accurate job_20 job_time
|
||||
build._log('run', 'Start running build %s' % build.dest)
|
||||
# run server
|
||||
@ -273,6 +282,8 @@ class ConfigStep(models.Model):
|
||||
|
||||
def _run_odoo_install(self, build, log_path):
|
||||
exports = build._checkout()
|
||||
# update job_start AFTER checkout to avoid build being killed too soon if checkout took some time and docker take some time to start
|
||||
build.job_start = now()
|
||||
|
||||
modules_to_install = self._modules_to_install(build)
|
||||
mods = ",".join(modules_to_install)
|
||||
|
@ -115,7 +115,7 @@ class runbot_repo(models.Model):
|
||||
repo.short_name = '/'.join(repo.base.split('/')[-2:])
|
||||
|
||||
def _get_repo_name_part(self):
|
||||
self.ensure_one
|
||||
self.ensure_one()
|
||||
return self._sanitized_name(self.name.split('/')[-1])
|
||||
|
||||
def _git(self, cmd):
|
||||
|
Loading…
Reference in New Issue
Block a user