mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] runbot: lock an host
In order to be able to test some custom code on one specific worker, this commit will allow to lock a runbot so that he will only run assigned build.
This commit is contained in:
parent
6bc666b5c3
commit
fe6788e349
@ -361,6 +361,7 @@ class runbot_repo(models.Model):
|
|||||||
settings_workers = int(icp.get_param('runbot.runbot_workers', default=6))
|
settings_workers = int(icp.get_param('runbot.runbot_workers', default=6))
|
||||||
workers = int(icp.get_param('%s.workers' % host, default=settings_workers))
|
workers = int(icp.get_param('%s.workers' % host, default=settings_workers))
|
||||||
running_max = int(icp.get_param('runbot.runbot_running_max', default=75))
|
running_max = int(icp.get_param('runbot.runbot_running_max', default=75))
|
||||||
|
assigned_only = int(icp.get_param('%s.assigned_only' % host, default=False))
|
||||||
|
|
||||||
Build = self.env['runbot.build']
|
Build = self.env['runbot.build']
|
||||||
domain = [('repo_id', 'in', ids)]
|
domain = [('repo_id', 'in', ids)]
|
||||||
@ -377,7 +378,7 @@ class runbot_repo(models.Model):
|
|||||||
nb_testing = Build.search_count(domain_host + [('local_state', '=', 'testing')])
|
nb_testing = Build.search_count(domain_host + [('local_state', '=', 'testing')])
|
||||||
available_slots = workers - nb_testing
|
available_slots = workers - nb_testing
|
||||||
reserved_slots = Build.search_count(domain_host + [('local_state', '=', 'pending')])
|
reserved_slots = Build.search_count(domain_host + [('local_state', '=', 'pending')])
|
||||||
assignable_slots = available_slots - reserved_slots
|
assignable_slots = (available_slots - reserved_slots) if not assigned_only else 0
|
||||||
if available_slots > 0:
|
if available_slots > 0:
|
||||||
if assignable_slots > 0: # note: slots have been addapt to be able to force host on pending build. Normally there is no pending with host.
|
if assignable_slots > 0: # note: slots have been addapt to be able to force host on pending build. Normally there is no pending with host.
|
||||||
# commit transaction to reduce the critical section duration
|
# commit transaction to reduce the critical section duration
|
||||||
|
Loading…
Reference in New Issue
Block a user