mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] runbot: move job_timeout
field to branch
This commit is contained in:
parent
8b5e0263bd
commit
238d6c6fab
@ -196,7 +196,6 @@ class runbot_repo(osv.osv):
|
|||||||
help="Community addon repos which need to be present to run tests."),
|
help="Community addon repos which need to be present to run tests."),
|
||||||
'token': fields.char("Github token"),
|
'token': fields.char("Github token"),
|
||||||
'group_ids': fields.many2many('res.groups', string='Limited to groups'),
|
'group_ids': fields.many2many('res.groups', string='Limited to groups'),
|
||||||
'job_timeout': fields.integer('Job Timeout (minutes)', required=True),
|
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'auto': True,
|
'auto': True,
|
||||||
@ -442,6 +441,7 @@ class runbot_branch(osv.osv):
|
|||||||
'coverage': fields.boolean('Coverage'),
|
'coverage': fields.boolean('Coverage'),
|
||||||
'state': fields.char('Status'),
|
'state': fields.char('Status'),
|
||||||
'modules': fields.char("Modules to Install", help="Comma-separated list of modules to install and test."),
|
'modules': fields.char("Modules to Install", help="Comma-separated list of modules to install and test."),
|
||||||
|
'job_timeout': fields.integer('Job Timeout (minutes)', help='For default timeout: Mark it zero'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_pull_info(self, cr, uid, ids, context=None):
|
def _get_pull_info(self, cr, uid, ids, context=None):
|
||||||
@ -953,6 +953,10 @@ class runbot_build(osv.osv):
|
|||||||
def schedule(self, cr, uid, ids, context=None):
|
def schedule(self, cr, uid, ids, context=None):
|
||||||
jobs = self.list_jobs()
|
jobs = self.list_jobs()
|
||||||
|
|
||||||
|
icp = self.pool['ir.config_parameter']
|
||||||
|
# For retro-compatibility, keep this parameter in seconds
|
||||||
|
default_timeout = int(icp.get_param(cr, uid, 'runbot.timeout', default=1800)) / 60
|
||||||
|
|
||||||
for build in self.browse(cr, uid, ids, context=context):
|
for build in self.browse(cr, uid, ids, context=context):
|
||||||
if build.state == 'pending':
|
if build.state == 'pending':
|
||||||
# allocate port and schedule first job
|
# allocate port and schedule first job
|
||||||
@ -972,7 +976,7 @@ class runbot_build(osv.osv):
|
|||||||
lock_path = build.path('logs', '%s.lock' % build.job)
|
lock_path = build.path('logs', '%s.lock' % build.job)
|
||||||
if locked(lock_path):
|
if locked(lock_path):
|
||||||
# kill if overpassed
|
# kill if overpassed
|
||||||
timeout = build.repo_id.job_timeout * 60
|
timeout = (build.branch_id.job_timeout or default_timeout) * 60
|
||||||
if build.job != jobs[-1] and build.job_time > timeout:
|
if build.job != jobs[-1] and build.job_time > timeout:
|
||||||
build.logger('%s time exceded (%ss)', build.job, build.job_time)
|
build.logger('%s time exceded (%ss)', build.job, build.job_time)
|
||||||
build.kill(result='killed')
|
build.kill(result='killed')
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
<field name="dependency_ids" widget="many2many_tags"/>
|
<field name="dependency_ids" widget="many2many_tags"/>
|
||||||
<field name="modules"/>
|
<field name="modules"/>
|
||||||
<field name="modules_auto"/>
|
<field name="modules_auto"/>
|
||||||
<field name="job_timeout"/>
|
|
||||||
<field name="token"/>
|
<field name="token"/>
|
||||||
<field name="group_ids" widget="many2many_tags"/>
|
<field name="group_ids" widget="many2many_tags"/>
|
||||||
</group>
|
</group>
|
||||||
@ -62,6 +61,7 @@
|
|||||||
<field name="branch_url"/>
|
<field name="branch_url"/>
|
||||||
<field name="pull_head_name"/>
|
<field name="pull_head_name"/>
|
||||||
<field name="sticky"/>
|
<field name="sticky"/>
|
||||||
|
<field name="job_timeout"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<field name="modules"/>
|
<field name="modules"/>
|
||||||
</group>
|
</group>
|
||||||
|
Loading…
Reference in New Issue
Block a user