Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1361)

Unified Diff: appengine/swarming/tools/start_bot.py

Issue 1373133004: Fixes and add smoke test: hard timeout on isolated task. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: . Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/task_runner.py ('k') | appengine/swarming/tools/start_servers.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/tools/start_bot.py
diff --git a/appengine/swarming/tools/start_bot.py b/appengine/swarming/tools/start_bot.py
index cf0ee0abc8586da51ed37598e708a53370359d6f..8771f589d7118de1ede8cda4d598f53da9254d71 100755
--- a/appengine/swarming/tools/start_bot.py
+++ b/appengine/swarming/tools/start_bot.py
@@ -53,7 +53,7 @@ class LocalBot(object):
else:
self._proc = subprocess.Popen(cmd, cwd=self._tmpdir, env=env, **kwargs)
- def stop(self):
+ def stop(self, leak):
"""Stops the local Swarming bot. Returns the process exit code."""
if not self._proc:
return None
@@ -68,10 +68,11 @@ class LocalBot(object):
if self._tmpdir:
for i in sorted(glob.glob(os.path.join(self._tmpdir, 'logs', '*.log'))):
self._read_log(i)
- try:
- shutil.rmtree(self._tmpdir)
- except OSError:
- print >> sys.stderr, 'Leaking %s' % self._tmpdir
+ if not leak:
+ try:
+ shutil.rmtree(self._tmpdir)
+ except OSError:
+ print >> sys.stderr, 'Leaking %s' % self._tmpdir
self._tmpdir = None
self._proc = None
return exit_code
@@ -119,7 +120,7 @@ def main():
except KeyboardInterrupt:
print >> sys.stderr, '<Ctrl-C> received; stopping bot'
finally:
- exit_code = bot.stop()
+ exit_code = bot.stop(False)
return exit_code
« no previous file with comments | « appengine/swarming/swarming_bot/bot_code/task_runner.py ('k') | appengine/swarming/tools/start_servers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698