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

Side by Side Diff: client/run_isolated.py

Issue 2973113003: [run_isolated] Tolerate cache uninstall errors. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | 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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 caches = [ 1046 caches = [
1047 (os.path.join(run_dir, unicode(relpath)), name) 1047 (os.path.join(run_dir, unicode(relpath)), name)
1048 for name, relpath in options.named_caches 1048 for name, relpath in options.named_caches
1049 ] 1049 ]
1050 with named_cache_manager.open(): 1050 with named_cache_manager.open():
1051 for path, name in caches: 1051 for path, name in caches:
1052 named_cache_manager.install(path, name) 1052 named_cache_manager.install(path, name)
1053 try: 1053 try:
1054 yield 1054 yield
1055 finally: 1055 finally:
1056 # Uninstall each named cache, returning it to the cache pool. If an
1057 # uninstall fails for a given cache, it will remain in the task's
1058 # temporary space, get cleaned up by the Swarming bot, and be lost.
1059 #
1060 # If the Swarming bot cannot clean up the cache, it will handle it like
1061 # any other bot file that could not be removed.
1056 with named_cache_manager.open(): 1062 with named_cache_manager.open():
1057 for path, name in caches: 1063 for path, name in caches:
1058 named_cache_manager.uninstall(path, name) 1064 try:
1065 named_cache_manager.uninstall(path, name)
Vadim Sh. 2017/07/07 18:01:46 does this thing leave 'named_cache_manager' in con
dnj 2017/07/07 18:14:12 Good question. It seems to: https://cs.chromium.or
1066 except named_cache.Error:
1067 logging.exception('Error while removing named cache %r at %r. '
1068 'The cache will be lost.', path, name)
1059 1069
1060 try: 1070 try:
1061 if options.isolate_server: 1071 if options.isolate_server:
1062 storage = isolateserver.get_storage( 1072 storage = isolateserver.get_storage(
1063 options.isolate_server, options.namespace) 1073 options.isolate_server, options.namespace)
1064 with storage: 1074 with storage:
1065 # Hashing schemes used by |storage| and |isolate_cache| MUST match. 1075 # Hashing schemes used by |storage| and |isolate_cache| MUST match.
1066 assert storage.hash_algo == isolate_cache.hash_algo 1076 assert storage.hash_algo == isolate_cache.hash_algo
1067 return run_tha_test( 1077 return run_tha_test(
1068 args, 1078 args,
(...skipping 29 matching lines...) Expand all
1098 return 1 1108 return 1
1099 1109
1100 1110
1101 if __name__ == '__main__': 1111 if __name__ == '__main__':
1102 subprocess42.inhibit_os_error_reporting() 1112 subprocess42.inhibit_os_error_reporting()
1103 # Ensure that we are always running with the correct encoding. 1113 # Ensure that we are always running with the correct encoding.
1104 fix_encoding.fix_encoding() 1114 fix_encoding.fix_encoding()
1105 file_path.enable_symlink() 1115 file_path.enable_symlink()
1106 1116
1107 sys.exit(main(sys.argv[1:])) 1117 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698