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

Side by Side Diff: client/tools/run_on_bots.py

Issue 1390773002: Add an assert to ensure UTF-8 locale when handling file paths. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: More fixes 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 | « client/tests/zip_package_test.py ('k') | client/tools/run_swarming_tests_on_swarming.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 2014 The Swarming Authors. All rights reserved. 2 # Copyright 2014 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 """Automated maintenance tool to run a script on bots. 6 """Automated maintenance tool to run a script on bots.
7 7
8 To use this script, write a self-contained python script (use a .zip if 8 To use this script, write a self-contained python script (use a .zip if
9 necessary), specify it on the command line and it will be packaged and triggered 9 necessary), specify it on the command line and it will be packaged and triggered
10 on all the swarming bots corresponding to the --dimension filters specified, or 10 on all the swarming bots corresponding to the --dimension filters specified, or
11 all the bots if no filter is specified. 11 all the bots if no filter is specified.
12 """ 12 """
13 13
14 __version__ = '0.1' 14 __version__ = '0.1'
15 15
16 import os 16 import os
17 import tempfile 17 import tempfile
18 import shutil 18 import shutil
19 import subprocess 19 import subprocess
20 import sys 20 import sys
21 21
22 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 22 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
23 23
24 # Must be first import. 24 # Must be first import.
25 import parallel_execution 25 import parallel_execution
26 26
27 from third_party import colorama 27 from third_party import colorama
28 from third_party.depot_tools import fix_encoding 28 from third_party.depot_tools import fix_encoding
29 from utils import file_path
29 from utils import tools 30 from utils import tools
30 31
31 32
32 def get_bot_list(swarming_server, dimensions, dead_only): 33 def get_bot_list(swarming_server, dimensions, dead_only):
33 """Returns a list of swarming bots.""" 34 """Returns a list of swarming bots."""
34 cmd = [ 35 cmd = [
35 sys.executable, 'swarming.py', 'bots', 36 sys.executable, 'swarming.py', 'bots',
36 '--swarming', swarming_server, 37 '--swarming', swarming_server,
37 '--bare', 38 '--bare',
38 ] 39 ]
(...skipping 21 matching lines...) Expand all
60 f.write(str(isolate)) 61 f.write(str(isolate))
61 shutil.copyfile(script, os.path.join(tempdir, base_script)) 62 shutil.copyfile(script, os.path.join(tempdir, base_script))
62 cmd = [ 63 cmd = [
63 sys.executable, 'isolate.py', 'archive', 64 sys.executable, 'isolate.py', 'archive',
64 '--isolate-server', isolate_server, 65 '--isolate-server', isolate_server,
65 '-i', isolate_file, 66 '-i', isolate_file,
66 '-s', isolated_file, 67 '-s', isolated_file,
67 ] 68 ]
68 return subprocess.check_output(cmd, cwd=ROOT_DIR).split()[0] 69 return subprocess.check_output(cmd, cwd=ROOT_DIR).split()[0]
69 finally: 70 finally:
70 shutil.rmtree(tempdir) 71 file_path.rmtree(tempdir)
71 72
72 73
73 def run_serial( 74 def run_serial(
74 swarming_server, isolate_server, priority, deadline, repeat, isolated_hash, 75 swarming_server, isolate_server, priority, deadline, repeat, isolated_hash,
75 name, bots): 76 name, bots):
76 """Runs the task one at a time. 77 """Runs the task one at a time.
77 78
78 This will be mainly bound by task scheduling latency, especially if the bots 79 This will be mainly bound by task scheduling latency, especially if the bots
79 are busy and the priority is low. 80 are busy and the priority is low.
80 """ 81 """
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 isolated_hash, 181 isolated_hash,
181 name, 182 name,
182 bots) 183 bots)
183 184
184 185
185 if __name__ == '__main__': 186 if __name__ == '__main__':
186 fix_encoding.fix_encoding() 187 fix_encoding.fix_encoding()
187 tools.disable_buffering() 188 tools.disable_buffering()
188 colorama.init() 189 colorama.init()
189 sys.exit(main()) 190 sys.exit(main())
OLDNEW
« no previous file with comments | « client/tests/zip_package_test.py ('k') | client/tools/run_swarming_tests_on_swarming.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698