mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[IMP] put the default timeout in runbot options
instead of hardcoding it
This commit is contained in:
parent
7261f5f479
commit
8e01b6b2c6
@ -26,13 +26,15 @@ class runbot_config_settings(osv.osv_memory):
|
||||
_inherit = 'res.config.settings'
|
||||
_columns = {
|
||||
'default_workers': fields.integer('Total Number of Workers'),
|
||||
'default_running_max': fields.integer('Maximum Number of Running Builds'),
|
||||
'default_running_max': fields.integer('Maximum Number of Running Builds'),
|
||||
'default_timeout': fields.integer('Default timeout (in seconds)'),
|
||||
}
|
||||
|
||||
def get_default_parameters(self, cr, uid, fields, context=None):
|
||||
icp = self.pool['ir.config_parameter']
|
||||
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)
|
||||
return {
|
||||
'default_workers': int(workers),
|
||||
'default_running_max': int(running_max)
|
||||
@ -43,10 +45,12 @@ class runbot_config_settings(osv.osv_memory):
|
||||
icp = self.pool['ir.config_parameter']
|
||||
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,
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,6 +24,10 @@
|
||||
<field name="default_running_max" class="oe_inline"/>
|
||||
<label for="default_running_max"/>
|
||||
</div>
|
||||
<div>
|
||||
<field name="default_timeout" class="oe_inline"/>
|
||||
<label for="default_timeout"/>
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
</form>
|
||||
|
@ -731,6 +731,9 @@ class runbot_build(osv.osv):
|
||||
|
||||
def schedule(self, cr, uid, ids, context=None):
|
||||
jobs = self.list_jobs()
|
||||
icp = self.pool['ir.config_parameter']
|
||||
timeout = int(icp.get_param(cr, uid, 'runbot.timeout', default=1800))
|
||||
|
||||
for build in self.browse(cr, uid, ids, context=context):
|
||||
if build.state == 'pending':
|
||||
# allocate port and schedule first job
|
||||
@ -749,7 +752,7 @@ class runbot_build(osv.osv):
|
||||
lock_path = build.path('logs', '%s.lock' % build.job)
|
||||
if locked(lock_path):
|
||||
# kill if overpassed
|
||||
if build.job != jobs[-1] and build.job_time > 1800:
|
||||
if build.job != jobs[-1] and build.job_time > timeout:
|
||||
build.logger('%s time exceded (%ss)', build.job, build.job_time)
|
||||
build.kill()
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user