mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[IMP] add starting port as configuration option
This commit is contained in:
parent
b4e680f095
commit
5579fae1c8
@ -27,7 +27,8 @@ class runbot_config_settings(osv.osv_memory):
|
||||
_columns = {
|
||||
'default_workers': fields.integer('Total Number of Workers'),
|
||||
'default_running_max': fields.integer('Maximum Number of Running Builds'),
|
||||
'default_timeout': fields.integer('Default timeout (in seconds)'),
|
||||
'default_timeout': fields.integer('Default Timeout (in seconds)'),
|
||||
'default_starting_port': fields.integer('Starting Port for Running Builds'),
|
||||
}
|
||||
|
||||
def get_default_parameters(self, cr, uid, fields, context=None):
|
||||
@ -35,9 +36,12 @@ class runbot_config_settings(osv.osv_memory):
|
||||
workers = icp.get_param(cr, uid, 'runbot.workers', default=6)
|
||||
running_max = icp.get_param(cr, uid, 'runbot.running_max', default=75)
|
||||
timeout = icp.get_param(cr, uid, 'runbot.timeout', default=1800)
|
||||
starting_port = icp.get_param(cr, uid, 'runbot.starting_port', default=2000)
|
||||
return {
|
||||
'default_workers': int(workers),
|
||||
'default_running_max': int(running_max)
|
||||
'default_running_max': int(running_max),
|
||||
'default_timeout': int(timeout),
|
||||
'default_starting_port': int(starting_port),
|
||||
}
|
||||
|
||||
def set_default_parameters(self, cr, uid, ids, context=None):
|
||||
@ -46,12 +50,7 @@ class runbot_config_settings(osv.osv_memory):
|
||||
icp.set_param(cr, uid, 'runbot.workers', config.default_workers)
|
||||
icp.set_param(cr, uid, 'runbot.running_max', config.default_running_max)
|
||||
icp.set_param(cr, uid, 'runbot.timeout', config.default_timeout)
|
||||
|
||||
_defaults = {
|
||||
'default_workers': 6,
|
||||
'default_running_max': 75,
|
||||
'default_timeout': 1800,
|
||||
}
|
||||
icp.set_param(cr, uid, 'runbot.starting_port', config.default_starting_port)
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
@ -28,6 +28,10 @@
|
||||
<field name="default_timeout" class="oe_inline"/>
|
||||
<label for="default_timeout"/>
|
||||
</div>
|
||||
<div>
|
||||
<field name="default_starting_port" class="oe_inline"/>
|
||||
<label for="default_starting_port"/>
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
</form>
|
||||
|
@ -474,8 +474,8 @@ class runbot_build(osv.osv):
|
||||
ports = set(i['port'] for i in self.read(cr, uid, ids, ['port']))
|
||||
|
||||
# starting port
|
||||
# TODO take ir.config.parameters or 9000
|
||||
port = 2000
|
||||
icp = self.pool['ir.config_parameter']
|
||||
port = int(icp.get_param(cr, uid, 'runbot.starting_port', default=2000))
|
||||
|
||||
# find next free port
|
||||
while port in ports:
|
||||
|
Loading…
Reference in New Issue
Block a user