diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2015-10-08 16:27:07 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2015-10-08 17:11:34 -0700 |
commit | e2686282ace62f8b6a5e9ed7c836b415605d053f (patch) | |
tree | cefcda7fc111044e1afe87ffa848bd0ca98db187 /tools/run_tests/jobset.py | |
parent | 9f06aba55c7c07d21055f3620e48885566f9e47b (diff) |
kill interop clients on timeout
Diffstat (limited to 'tools/run_tests/jobset.py')
-rwxr-xr-x | tools/run_tests/jobset.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py index 87be703b4c..17a63c02e8 100755 --- a/tools/run_tests/jobset.py +++ b/tools/run_tests/jobset.py @@ -135,13 +135,14 @@ class JobSpec(object): def __init__(self, cmdline, shortname=None, environ=None, hash_targets=None, cwd=None, shell=False, timeout_seconds=5*60, flake_retries=0, - timeout_retries=0): + timeout_retries=0, kill_handler=None): """ Arguments: cmdline: a list of arguments to pass as the command line environ: a dictionary of environment variables to set in the child process hash_targets: which files to include in the hash representing the jobs version (or empty, indicating the job should not be hashed) + kill_handler: a handler that will be called whenever job.kill() is invoked """ if environ is None: environ = {} @@ -156,6 +157,7 @@ class JobSpec(object): self.timeout_seconds = timeout_seconds self.flake_retries = flake_retries self.timeout_retries = timeout_retries + self.kill_handler = kill_handler def identity(self): return '%r %r %r' % (self.cmdline, self.environ, self.hash_targets) @@ -254,6 +256,8 @@ class Job(object): def kill(self): if self._state == _RUNNING: self._state = _KILLED + if self._spec.kill_handler: + self._spec.kill_handler(self) self._process.terminate() def suppress_failure_message(self): |