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

Side by Side Diff: appengine/swarming/tools/start_servers.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, 2 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 unified diff | Download patch
« no previous file with comments | « appengine/swarming/tools/start_bot.py ('k') | client/utils/logging_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Swarming Authors. All rights reserved. 2 # Copyright 2015 The Swarming Authors. All rights reserved.
3 # Use of this source code is governed by the Apache v2.0 license that can be 3 # Use of this source code is governed by the Apache v2.0 license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Starts local Swarming and Isolate servers.""" 6 """Starts local Swarming and Isolate servers."""
7 7
8 import argparse 8 import argparse
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 self._isolate_server = local_app.LocalApplication( 52 self._isolate_server = local_app.LocalApplication(
53 os.path.join(APP_DIR, '..', 'isolate'), 10050, self._listen_all) 53 os.path.join(APP_DIR, '..', 'isolate'), 10050, self._listen_all)
54 self._isolate_server.start() 54 self._isolate_server.start()
55 self._swarming_server.ensure_serving() 55 self._swarming_server.ensure_serving()
56 self._isolate_server.ensure_serving() 56 self._isolate_server.ensure_serving()
57 57
58 self.http_client.login_as_admin('smoke-test@example.com') 58 self.http_client.login_as_admin('smoke-test@example.com')
59 self.http_client.url_opener.addheaders.append( 59 self.http_client.url_opener.addheaders.append(
60 ('X-XSRF-Token', self._swarming_server.client.xsrf_token)) 60 ('X-XSRF-Token', self._swarming_server.client.xsrf_token))
61 61
62 def stop(self): 62 def stop(self, leak):
63 """Stops the local Swarming and Isolate servers. 63 """Stops the local Swarming and Isolate servers.
64 64
65 Returns the exit code with priority to non-zero. 65 Returns the exit code with priority to non-zero.
66 """ 66 """
67 exit_code = None 67 exit_code = None
68 try: 68 try:
69 if self._isolate_server: 69 if self._isolate_server:
70 exit_code = exit_code or self._isolate_server.stop() 70 exit_code = exit_code or self._isolate_server.stop(leak)
71 finally: 71 finally:
72 if self._swarming_server: 72 if self._swarming_server:
73 exit_code = exit_code or self._swarming_server.stop() 73 exit_code = exit_code or self._swarming_server.stop(leak)
74 return exit_code 74 return exit_code
75 75
76 def wait(self): 76 def wait(self):
77 """Wait for the processes to normally exit.""" 77 """Wait for the processes to normally exit."""
78 if self._isolate_server: 78 if self._isolate_server:
79 self._isolate_server.wait() 79 self._isolate_server.wait()
80 if self._swarming_server: 80 if self._swarming_server:
81 self._swarming_server.wait() 81 self._swarming_server.wait()
82 82
83 def dump_log(self): 83 def dump_log(self):
(...skipping 10 matching lines...) Expand all
94 servers = LocalServers(args.all) 94 servers = LocalServers(args.all)
95 try: 95 try:
96 servers.start() 96 servers.start()
97 print('Swarming: %s' % servers.swarming_server.url) 97 print('Swarming: %s' % servers.swarming_server.url)
98 print('Isolate : %s' % servers.isolate_server.url) 98 print('Isolate : %s' % servers.isolate_server.url)
99 servers.wait() 99 servers.wait()
100 servers.dump_log() 100 servers.dump_log()
101 except KeyboardInterrupt: 101 except KeyboardInterrupt:
102 print >> sys.stderr, '<Ctrl-C> received; stopping servers' 102 print >> sys.stderr, '<Ctrl-C> received; stopping servers'
103 finally: 103 finally:
104 exit_code = servers.stop() 104 exit_code = servers.stop(False)
105 return exit_code 105 return exit_code
106 106
107 107
108 if __name__ == '__main__': 108 if __name__ == '__main__':
109 sys.exit(main()) 109 sys.exit(main())
OLDNEW
« no previous file with comments | « appengine/swarming/tools/start_bot.py ('k') | client/utils/logging_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698