mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] runbot: allow to define a per host nb run
This commit is contained in:
parent
269e59538e
commit
faa2f718ad
@ -26,10 +26,16 @@ class Host(models.Model):
|
|||||||
last_success = fields.Datetime('Last success')
|
last_success = fields.Datetime('Last success')
|
||||||
assigned_only = fields.Boolean('Only accept assigned build', default=False, tracking=True)
|
assigned_only = fields.Boolean('Only accept assigned build', default=False, tracking=True)
|
||||||
nb_worker = fields.Integer(
|
nb_worker = fields.Integer(
|
||||||
'Number of max paralel build',
|
'Number of max parallel build',
|
||||||
default=lambda self: self.env['ir.config_parameter'].sudo().get_param('runbot.runbot_workers', default=2),
|
default=lambda self: self.env['ir.config_parameter'].sudo().get_param('runbot.runbot_workers', default=2),
|
||||||
tracking=True
|
tracking=True,
|
||||||
)
|
)
|
||||||
|
nb_run_slot = fields.Integer(
|
||||||
|
'Number of max parallel running build',
|
||||||
|
default=0,
|
||||||
|
tracking=True,
|
||||||
|
)
|
||||||
|
|
||||||
nb_testing = fields.Integer(compute='_compute_nb')
|
nb_testing = fields.Integer(compute='_compute_nb')
|
||||||
nb_running = fields.Integer(compute='_compute_nb')
|
nb_running = fields.Integer(compute='_compute_nb')
|
||||||
last_exception = fields.Char('Last exception')
|
last_exception = fields.Char('Last exception')
|
||||||
@ -41,6 +47,7 @@ class Host(models.Model):
|
|||||||
paused = fields.Boolean('Paused', help='Host will stop scheduling while paused')
|
paused = fields.Boolean('Paused', help='Host will stop scheduling while paused')
|
||||||
profile = fields.Boolean('Profile', help='Enable profiling on this host')
|
profile = fields.Boolean('Profile', help='Enable profiling on this host')
|
||||||
|
|
||||||
|
|
||||||
def _compute_nb(self):
|
def _compute_nb(self):
|
||||||
groups = self.env['runbot.build'].read_group(
|
groups = self.env['runbot.build'].read_group(
|
||||||
[('host', 'in', self.mapped('name')), ('local_state', 'in', ('testing', 'running'))],
|
[('host', 'in', self.mapped('name')), ('local_state', 'in', ('testing', 'running'))],
|
||||||
@ -168,7 +175,7 @@ class Host(models.Model):
|
|||||||
|
|
||||||
def _get_running_max(self):
|
def _get_running_max(self):
|
||||||
icp = self.env['ir.config_parameter']
|
icp = self.env['ir.config_parameter']
|
||||||
return int(icp.get_param('runbot.runbot_running_max', default=5))
|
return self.nb_run_slot or int(icp.get_param('runbot.runbot_running_max', default=5))
|
||||||
|
|
||||||
def _set_psql_conn_count(self):
|
def _set_psql_conn_count(self):
|
||||||
_logger.info('Updating psql connection count...')
|
_logger.info('Updating psql connection count...')
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
<field name="last_success" readonly='1'/>
|
<field name="last_success" readonly='1'/>
|
||||||
<field name="assigned_only"/>
|
<field name="assigned_only"/>
|
||||||
<field name="nb_worker"/>
|
<field name="nb_worker"/>
|
||||||
|
<field name="nb_run_slot"/>
|
||||||
<field name="build_ids" widget="many2many" options="{'not_delete': True, 'no_create_edit': True}" readonly="1">
|
<field name="build_ids" widget="many2many" options="{'not_delete': True, 'no_create_edit': True}" readonly="1">
|
||||||
<tree>
|
<tree>
|
||||||
<field name="create_date"/>
|
<field name="create_date"/>
|
||||||
@ -47,6 +48,7 @@
|
|||||||
<field name="disp_name"/>
|
<field name="disp_name"/>
|
||||||
<field name="assigned_only" widget="boolean_toggle"/>
|
<field name="assigned_only" widget="boolean_toggle"/>
|
||||||
<field name="nb_worker"/>
|
<field name="nb_worker"/>
|
||||||
|
<field name="nb_run_slot"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
Loading…
Reference in New Issue
Block a user