Skip to content
Snippets Groups Projects
Commit 8d453c59 authored by Craig Tiller's avatar Craig Tiller
Browse files

Merge pull request #2757 from jtattermusch/runtest_polishing

Runtest polishing
parents 8956e606 725835ab
No related branches found
No related tags found
No related merge requests found
...@@ -130,7 +130,8 @@ def which(filename): ...@@ -130,7 +130,8 @@ def which(filename):
class JobSpec(object): class JobSpec(object):
"""Specifies what to run for a job.""" """Specifies what to run for a job."""
def __init__(self, cmdline, shortname=None, environ=None, hash_targets=None, cwd=None, shell=False): def __init__(self, cmdline, shortname=None, environ=None, hash_targets=None,
cwd=None, shell=False, timeout_seconds=900):
""" """
Arguments: Arguments:
cmdline: a list of arguments to pass as the command line cmdline: a list of arguments to pass as the command line
...@@ -148,6 +149,7 @@ class JobSpec(object): ...@@ -148,6 +149,7 @@ class JobSpec(object):
self.hash_targets = hash_targets or [] self.hash_targets = hash_targets or []
self.cwd = cwd self.cwd = cwd
self.shell = shell self.shell = shell
self.timeout_seconds = timeout_seconds
def identity(self): def identity(self):
return '%r %r %r' % (self.cmdline, self.environ, self.hash_targets) return '%r %r %r' % (self.cmdline, self.environ, self.hash_targets)
...@@ -206,7 +208,7 @@ class Job(object): ...@@ -206,7 +208,7 @@ class Job(object):
do_newline=self._newline_on_success or self._travis) do_newline=self._newline_on_success or self._travis)
if self._bin_hash: if self._bin_hash:
update_cache.finished(self._spec.identity(), self._bin_hash) update_cache.finished(self._spec.identity(), self._bin_hash)
elif self._state == _RUNNING and time.time() - self._start > 900: elif self._state == _RUNNING and time.time() - self._start > self._spec.timeout_seconds:
self._tempfile.seek(0) self._tempfile.seek(0)
stdout = self._tempfile.read() stdout = self._tempfile.read()
filtered_stdout = filter(lambda x: x in string.printable, stdout.decode(errors='ignore')) filtered_stdout = filter(lambda x: x in string.printable, stdout.decode(errors='ignore'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment