Skip to content

Commit

Permalink
fixed handling timeout in pylint and repos in triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
godfryd committed Oct 14, 2021
1 parent 551a86f commit b33cea6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion agent/kraken/agent/kraken_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ def run_analysis(step, report_issue=None):
rcfile = step['rcfile']
modules_or_packages = step['modules_or_packages']
pylint_exe = step.get('pylint_exe', 'pylint')
timeout = int(step.get('timeout', 60))

with tempfile.NamedTemporaryFile(suffix=".json", prefix="pylint-result-") as fh:
result_file = fh.name
cmd = 'sh -c "%s --exit-zero -f json --rcfile=%s %s > %s"' % (pylint_exe, rcfile, modules_or_packages, result_file)
ret, _ = utils.execute(cmd, cwd=cwd, out_prefix='', timeout=180)
ret, _ = utils.execute(cmd, cwd=cwd, out_prefix='', timeout=timeout)

if ret != 0:
log.error('pylint exited with non-zero retcode: %s', ret)
Expand Down
28 changes: 17 additions & 11 deletions server/kraken/server/schemaval.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,7 @@
"triggers": {
"parent": True,
"cron": "1 * * * *",
"interval": "10m",
"repository": True,
"webhook": True
"interval": "10m"
},
"parameters": [],
"configs": [
Expand Down Expand Up @@ -662,14 +660,17 @@
"type": "string"
},
"repos": {
"type": "object",
"additionalProperties": False,
"properties": {
"url": {
"type": "string"
},
"branch": {
"type": "string"
"type": "array",
"items": {
"type": "object",
"additionalProperties": False,
"properties": {
"url": {
"type": "string"
},
"branch": {
"type": "string"
}
}
}
},
Expand Down Expand Up @@ -1025,6 +1026,11 @@
"description": "A sleep time between subsequent execution attempts.",
"default": 0,
"type": "integer"
},
"timeout": {
"description": "A timeout in seconds that limits time of step execution. It is guareded by an agent. If it is exceeded then the step is arbitrarly terminated.",
"type": "integer",
"minimum": 30
}
}
},
Expand Down

0 comments on commit b33cea6

Please sign in to comment.