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

Side by Side Diff: client/run_isolated.py

Issue 2186263002: luci-py: Refactor file writing code to allow file objects. (Closed) Base URL: https://github.com/luci/luci-py.git@master
Patch Set: Rebase Created 4 years, 4 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 | « client/isolateserver.py ('k') | client/tests/isolateserver_test.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 2012 The LUCI Authors. All rights reserved. 2 # Copyright 2012 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 """Runs a command with optional isolated input/output. 6 """Runs a command with optional isolated input/output.
7 7
8 Despite name "run_isolated", can run a generic non-isolated command specified as 8 Despite name "run_isolated", can run a generic non-isolated command specified as
9 args. 9 args.
10 10
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 storage=storage, 274 storage=storage,
275 cache=cache, 275 cache=cache,
276 outdir=outdir, 276 outdir=outdir,
277 use_symlinks=use_symlinks) 277 use_symlinks=use_symlinks)
278 return bundle, { 278 return bundle, {
279 'duration': time.time() - start, 279 'duration': time.time() - start,
280 'initial_number_items': cache.initial_number_items, 280 'initial_number_items': cache.initial_number_items,
281 'initial_size': cache.initial_size, 281 'initial_size': cache.initial_size,
282 'items_cold': base64.b64encode(large.pack(sorted(cache.added))), 282 'items_cold': base64.b64encode(large.pack(sorted(cache.added))),
283 'items_hot': base64.b64encode( 283 'items_hot': base64.b64encode(
284 large.pack(sorted(set(cache.linked) - set(cache.added)))), 284 large.pack(sorted(set(cache.used) - set(cache.added)))),
285 } 285 }
286 286
287 287
288 def delete_and_upload(storage, out_dir, leak_temp_dir): 288 def delete_and_upload(storage, out_dir, leak_temp_dir):
289 """Deletes the temporary run directory and uploads results back. 289 """Deletes the temporary run directory and uploads results back.
290 290
291 Returns: 291 Returns:
292 tuple(outputs_ref, success, stats) 292 tuple(outputs_ref, success, stats)
293 - outputs_ref: a dict referring to the results archived back to the isolated 293 - outputs_ref: a dict referring to the results archived back to the isolated
294 server, if applicable. 294 server, if applicable.
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 print >> sys.stderr, ex.message 769 print >> sys.stderr, ex.message
770 return 1 770 return 1
771 771
772 772
773 if __name__ == '__main__': 773 if __name__ == '__main__':
774 subprocess42.inhibit_os_error_reporting() 774 subprocess42.inhibit_os_error_reporting()
775 # Ensure that we are always running with the correct encoding. 775 # Ensure that we are always running with the correct encoding.
776 fix_encoding.fix_encoding() 776 fix_encoding.fix_encoding()
777 file_path.enable_symlink() 777 file_path.enable_symlink()
778 sys.exit(main(sys.argv[1:])) 778 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « client/isolateserver.py ('k') | client/tests/isolateserver_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698