mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot: add a separate pending count
The assigned build are in the same count of the pending build. This can sometimes create a false queue, because you can have 1000 pending builds on one host, this doesn't mean that a new standard build cannot be immediatly taken by another host. This is mainly to hide the false queue created by the full charge zfs build currently running and creating ~400 assigned build.
This commit is contained in:
parent
74f0c8e1ad
commit
0d29643d52
@ -73,10 +73,11 @@ class Runbot(Controller):
|
||||
ICP = request.env['ir.config_parameter'].sudo().get_param
|
||||
warn = int(ICP('runbot.pending.warning', 5))
|
||||
crit = int(ICP('runbot.pending.critical', 12))
|
||||
pending_count = request.env['runbot.build'].search_count([('local_state', '=', 'pending'), ('build_type', '!=', 'scheduled')])
|
||||
pending_count = request.env['runbot.build'].search_count([('local_state', '=', 'pending'), ('build_type', '!=', 'scheduled'), ('host', '=', False)])
|
||||
scheduled_count = request.env['runbot.build'].search_count([('local_state', '=', 'pending'), ('build_type', '=', 'scheduled')])
|
||||
pending_assigned_count = request.env['runbot.build'].search_count([('local_state', '=', 'pending'), ('build_type', '!=', 'scheduled'), ('host', '!=', False)])
|
||||
level = ['info', 'warning', 'danger'][int(pending_count > warn) + int(pending_count > crit)]
|
||||
return pending_count, level, scheduled_count
|
||||
return pending_count, level, scheduled_count, pending_assigned_count
|
||||
|
||||
@o_route([
|
||||
'/runbot/submit'
|
||||
@ -112,12 +113,13 @@ class Runbot(Controller):
|
||||
if not project and projects:
|
||||
project = projects[0]
|
||||
|
||||
pending_count, level, scheduled_count = self._pending()
|
||||
pending_count, level, scheduled_count, pending_assigned_count = self._pending()
|
||||
context = {
|
||||
'categories': categories,
|
||||
'search': search,
|
||||
'message': request.env['ir.config_parameter'].sudo().get_param('runbot.runbot_message'),
|
||||
'pending_total': pending_count,
|
||||
'pending_count': pending_count,
|
||||
'pending_assigned_count': pending_assigned_count,
|
||||
'pending_level': level,
|
||||
'scheduled_count': scheduled_count,
|
||||
'hosts_data': request.env['runbot.host'].search([('assigned_only', '=', False)]),
|
||||
@ -359,10 +361,11 @@ class Runbot(Controller):
|
||||
def glances(self, project_id=None, **kwargs):
|
||||
project_ids = [project_id] if project_id else request.env['runbot.project'].search([]).ids # search for access rights
|
||||
bundles = request.env['runbot.bundle'].search([('sticky', '=', True), ('project_id', 'in', project_ids)])
|
||||
pending = self._pending()
|
||||
pending_count, level, scheduled_count, pending_assigned_count = self._pending()
|
||||
qctx = {
|
||||
'pending_total': pending[0],
|
||||
'pending_level': pending[1],
|
||||
'pending_count': pending_count,
|
||||
'pending_assigned_count': pending_assigned_count,
|
||||
'pending_level': level,
|
||||
'bundles': bundles,
|
||||
'title': 'Glances'
|
||||
}
|
||||
@ -372,7 +375,7 @@ class Runbot(Controller):
|
||||
'/runbot/monitoring/<int:category_id>',
|
||||
'/runbot/monitoring/<int:category_id>/<int:view_id>'], type='http', auth='user', website=True, sitemap=False)
|
||||
def monitoring(self, category_id=None, view_id=None, **kwargs):
|
||||
pending = self._pending()
|
||||
pending_count, level, scheduled_count, pending_assigned_count = self._pending()
|
||||
hosts_data = request.env['runbot.host'].search([])
|
||||
if category_id:
|
||||
category = request.env['runbot.category'].browse(category_id)
|
||||
@ -383,9 +386,10 @@ class Runbot(Controller):
|
||||
bundles = request.env['runbot.bundle'].search([('sticky', '=', True)]) # NOTE we dont filter on project
|
||||
qctx = {
|
||||
'category': category,
|
||||
'pending_total': pending[0],
|
||||
'pending_level': pending[1],
|
||||
'scheduled_count': pending[2],
|
||||
'pending_count': pending_count,
|
||||
'pending_assigned_count': pending_assigned_count,
|
||||
'pending_level': level,
|
||||
'scheduled_count': scheduled_count,
|
||||
'bundles': bundles,
|
||||
'hosts_data': hosts_data,
|
||||
'auto_tags': request.env['runbot.build.error'].disabling_tags(),
|
||||
@ -578,10 +582,11 @@ class Runbot(Controller):
|
||||
|
||||
build_by_bundle = list(build_by_bundle.items())
|
||||
build_by_bundle.sort(key=lambda x: -len(x[1]))
|
||||
pending_count, level, scheduled_count = self._pending()
|
||||
pending_count, level, scheduled_count, pending_assigned_count = self._pending()
|
||||
context = {
|
||||
'build_by_bundle': build_by_bundle,
|
||||
'pending_total': pending_count,
|
||||
'pending_count': pending_count,
|
||||
'pending_assigned_count': pending_assigned_count,
|
||||
'pending_level': level,
|
||||
'scheduled_count': scheduled_count,
|
||||
'hosts_data': request.env['runbot.host'].search([('assigned_only', '=', False)]),
|
||||
|
@ -14,7 +14,7 @@
|
||||
<div>
|
||||
<span t-attf-class="badge badge-{{pending_level}}">
|
||||
Pending:
|
||||
<t t-esc="pending_total"/>
|
||||
<t t-esc="pending_count"/><span title="Assigned build (reserved host)" t-if="pending_assigned_count">(<t t-esc="pending_assigned_count"/>)</span>
|
||||
</span>
|
||||
</div>
|
||||
<t t-set="project_id"/>
|
||||
|
@ -168,7 +168,7 @@
|
||||
<a href="/runbot/load_info" class="slots_infos">
|
||||
<span t-attf-class="badge badge-{{pending_level}}">
|
||||
Pending:
|
||||
<t t-esc="pending_total"/>
|
||||
<t t-esc="pending_count"/><span title="Assigned build (reserved host)" t-if="pending_assigned_count">(<t t-esc="pending_assigned_count"/>)</span>
|
||||
</span>
|
||||
<t t-set="testing" t-value="hosts_data._total_testing()"/>
|
||||
<t t-set="workers" t-value="hosts_data._total_workers()"/>
|
||||
|
Loading…
Reference in New Issue
Block a user