mirror of
https://github.com/odoo/runbot.git
synced 2025-03-30 14:55:45 +07:00
[FIX] runbot: less noisy log
Some data are logged at each loop turn even if nothing interresting was done: - ... builds [] where allocated to runbot - reload nginx That kind of info was interresting for debug but now this noise makes logs heavier and more difficult to read. Reload ngnix will be done only if file changed and this this will avoid a log at each loop turn. We also display difference between existing sources and source that should be there instead of complete lists.
This commit is contained in:
parent
75dc7bd605
commit
0efd3fde1d
@ -458,10 +458,12 @@ class runbot_repo(models.Model):
|
|||||||
return self.env.cr.fetchall()
|
return self.env.cr.fetchall()
|
||||||
|
|
||||||
allocated = allocate_builds("""AND runbot_build.build_type != 'scheduled'""", assignable_slots)
|
allocated = allocate_builds("""AND runbot_build.build_type != 'scheduled'""", assignable_slots)
|
||||||
|
if allocated:
|
||||||
_logger.debug('Normal builds %s where allocated to runbot' % allocated)
|
_logger.debug('Normal builds %s where allocated to runbot' % allocated)
|
||||||
weak_slot = assignable_slots - len(allocated) - 1
|
weak_slot = assignable_slots - len(allocated) - 1
|
||||||
if weak_slot > 0:
|
if weak_slot > 0:
|
||||||
allocated = allocate_builds('', weak_slot)
|
allocated = allocate_builds('', weak_slot)
|
||||||
|
if allocated:
|
||||||
_logger.debug('Scheduled builds %s where allocated to runbot' % allocated)
|
_logger.debug('Scheduled builds %s where allocated to runbot' % allocated)
|
||||||
|
|
||||||
pending_build = Build.search(domain_host + [('local_state', '=', 'pending')], limit=available_slots)
|
pending_build = Build.search(domain_host + [('local_state', '=', 'pending')], limit=available_slots)
|
||||||
@ -501,10 +503,14 @@ class runbot_repo(models.Model):
|
|||||||
|
|
||||||
nginx_config = self.env['ir.ui.view'].render_template("runbot.nginx_config", settings)
|
nginx_config = self.env['ir.ui.view'].render_template("runbot.nginx_config", settings)
|
||||||
os.makedirs(nginx_dir, exist_ok=True)
|
os.makedirs(nginx_dir, exist_ok=True)
|
||||||
with open(os.path.join(nginx_dir, 'nginx.conf'), 'wb') as nginx_file:
|
content = None
|
||||||
nginx_file.write(nginx_config)
|
with open(os.path.join(nginx_dir, 'nginx.conf'), 'rb') as f:
|
||||||
try:
|
content = f.read()
|
||||||
|
if content != nginx_config:
|
||||||
_logger.debug('reload nginx')
|
_logger.debug('reload nginx')
|
||||||
|
with open(os.path.join(nginx_dir, 'nginx.conf'), 'wb') as f:
|
||||||
|
f.write(nginx_config)
|
||||||
|
try:
|
||||||
pid = int(open(os.path.join(nginx_dir, 'nginx.pid')).read().strip(' \n'))
|
pid = int(open(os.path.join(nginx_dir, 'nginx.pid')).read().strip(' \n'))
|
||||||
os.kill(pid, signal.SIGHUP)
|
os.kill(pid, signal.SIGHUP)
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -614,7 +620,7 @@ class runbot_repo(models.Model):
|
|||||||
shutil.rmtree(source_dir)
|
shutil.rmtree(source_dir)
|
||||||
_logger.info('%s/%s source folder where deleted (%s kept)' % (len(to_delete), len(to_delete+to_keep), len(to_keep)))
|
_logger.info('%s/%s source folder where deleted (%s kept)' % (len(to_delete), len(to_delete+to_keep), len(to_keep)))
|
||||||
else:
|
else:
|
||||||
_logger.warning('Inconsistency between sources and database: %s %s' % (cannot_be_deleted_path, to_keep))
|
_logger.warning('Inconsistency between sources and database: \n%s \n%s' % (cannot_be_deleted_path-to_keep, to_keep-cannot_be_deleted_path))
|
||||||
|
|
||||||
except:
|
except:
|
||||||
_logger.error('An exception occured while cleaning sources')
|
_logger.error('An exception occured while cleaning sources')
|
||||||
|
Loading…
Reference in New Issue
Block a user