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

Side by Side Diff: client/run_isolated.py

Issue 1233303003: Migrate and merge logging_utils from swarming_bot into client/utils. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Changed formatter Created 5 years, 5 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2012 The Swarming Authors. All rights reserved. 2 # Copyright 2012 The Swarming Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 that 3 # Use of this source code is governed under the Apache License, Version 2.0 that
4 # can be found in the LICENSE file. 4 # can be found in the LICENSE file.
5 5
6 """Reads a .isolated, creates a tree of hardlinks and runs the test. 6 """Reads a .isolated, creates a tree of hardlinks and runs the test.
7 7
8 To improve performance, it keeps a local cache. The local cache can safely be 8 To improve performance, it keeps a local cache. The local cache can safely be
9 deleted. 9 deleted.
10 10
11 Any ${ISOLATED_OUTDIR} on the command line will be replaced by the location of a 11 Any ${ISOLATED_OUTDIR} on the command line will be replaced by the location of a
12 temporary directory upon execution of the command specified in the .isolated 12 temporary directory upon execution of the command specified in the .isolated
13 file. All content written to this directory will be uploaded upon termination 13 file. All content written to this directory will be uploaded upon termination
14 and the .isolated file describing this directory will be printed to stdout. 14 and the .isolated file describing this directory will be printed to stdout.
15 """ 15 """
16 16
17 __version__ = '0.4.1' 17 __version__ = '0.4.1'
18 18
19 import logging 19 import logging
20 import optparse 20 import optparse
21 import os 21 import os
22 import sys 22 import sys
23 import tempfile 23 import tempfile
24 24
25 from third_party.depot_tools import fix_encoding 25 from third_party.depot_tools import fix_encoding
26 26
27 from utils import file_path 27 from utils import file_path
28 from utils import logging_utils
28 from utils import on_error 29 from utils import on_error
29 from utils import subprocess42 30 from utils import subprocess42
30 from utils import tools 31 from utils import tools
31 from utils import zip_package 32 from utils import zip_package
32 33
33 import auth 34 import auth
34 import isolated_format 35 import isolated_format
35 import isolateserver 36 import isolateserver
36 37
37 38
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 # file deletion may fail when a test failed. 266 # file deletion may fail when a test failed.
266 if sys.platform != 'win32' or not result: 267 if sys.platform != 'win32' or not result:
267 on_error.report(None) 268 on_error.report(None)
268 result = 1 269 result = 1
269 270
270 return result 271 return result
271 272
272 273
273 def main(args): 274 def main(args):
274 tools.disable_buffering() 275 tools.disable_buffering()
275 parser = tools.OptionParserWithLogging( 276 parser = logging_utils.OptionParserWithLogging(
276 usage='%prog <options>', 277 usage='%prog <options>',
277 version=__version__, 278 version=__version__,
278 log_file=RUN_ISOLATED_LOG_FILE) 279 log_file=RUN_ISOLATED_LOG_FILE)
279 280
280 data_group = optparse.OptionGroup(parser, 'Data source') 281 data_group = optparse.OptionGroup(parser, 'Data source')
281 data_group.add_option( 282 data_group.add_option(
282 '-s', '--isolated', 283 '-s', '--isolated',
283 help='Hash of the .isolated to grab from the isolate server') 284 help='Hash of the .isolated to grab from the isolate server')
284 data_group.add_option( 285 data_group.add_option(
285 '-H', dest='isolated', help=optparse.SUPPRESS_HELP) 286 '-H', dest='isolated', help=optparse.SUPPRESS_HELP)
(...skipping 24 matching lines...) Expand all
310 # Hashing schemes used by |storage| and |cache| MUST match. 311 # Hashing schemes used by |storage| and |cache| MUST match.
311 assert storage.hash_algo == cache.hash_algo 312 assert storage.hash_algo == cache.hash_algo
312 return run_tha_test( 313 return run_tha_test(
313 options.isolated, storage, cache, options.leak_temp_dir, args) 314 options.isolated, storage, cache, options.leak_temp_dir, args)
314 315
315 316
316 if __name__ == '__main__': 317 if __name__ == '__main__':
317 # Ensure that we are always running with the correct encoding. 318 # Ensure that we are always running with the correct encoding.
318 fix_encoding.fix_encoding() 319 fix_encoding.fix_encoding()
319 sys.exit(main(sys.argv[1:])) 320 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « client/isolateserver.py ('k') | client/swarming.py » ('j') | client/utils/tools.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698