OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 from recipe_engine import recipe_api | 6 from recipe_engine import recipe_api |
7 import shlex | 7 import shlex |
8 | 8 |
9 | 9 |
10 DEFAULT_TASK_EXPIRATION = 4*60*60 | 10 DEFAULT_TASK_EXPIRATION = 4*60*60 |
11 DEFAULT_TASK_TIMEOUT = 60*60 | 11 DEFAULT_TASK_TIMEOUT = 60*60 |
12 DEFAULT_IO_TIMEOUT = 20*60 | 12 DEFAULT_IO_TIMEOUT = 20*60 |
13 | 13 |
14 | 14 |
15 class SkiaSwarmingApi(recipe_api.RecipeApi): | 15 class SkiaSwarmingApi(recipe_api.RecipeApi): |
16 """Provides steps to run Skia tasks on swarming bots.""" | 16 """Provides steps to run Skia tasks on swarming bots.""" |
17 | 17 |
18 @property | 18 @property |
19 def swarming_temp_dir(self): | 19 def swarming_temp_dir(self): |
20 """Path where artifacts like isolate file and json output will be stored.""" | 20 """Path where artifacts like isolate file and json output will be stored.""" |
21 return self.m.infra_paths['slave_build'].join('swarming_temp_dir') | 21 return self.m.path['slave_build'].join('swarming_temp_dir') |
22 | 22 |
23 @property | 23 @property |
24 def tasks_output_dir(self): | 24 def tasks_output_dir(self): |
25 """Directory where the outputs of the swarming tasks will be stored.""" | 25 """Directory where the outputs of the swarming tasks will be stored.""" |
26 return self.swarming_temp_dir.join('outputs') | 26 return self.swarming_temp_dir.join('outputs') |
27 | 27 |
28 def isolated_file_path(self, task_name): | 28 def isolated_file_path(self, task_name): |
29 """Get the path to the given task's .isolated file.""" | 29 """Get the path to the given task's .isolated file.""" |
30 return self.swarming_temp_dir.join('skia-task-%s.isolated' % task_name) | 30 return self.swarming_temp_dir.join('skia-task-%s.isolated' % task_name) |
31 | 31 |
(...skipping 12 matching lines...) Expand all Loading... |
44 '-d', luci_go_dir.join('linux64')]) | 44 '-d', luci_go_dir.join('linux64')]) |
45 self.m.step('download luci-go mac', | 45 self.m.step('download luci-go mac', |
46 ['download_from_google_storage', '--no_resume', | 46 ['download_from_google_storage', '--no_resume', |
47 '--platform=darwin', '--no_auth', '--bucket', 'chromium-luci', | 47 '--platform=darwin', '--no_auth', '--bucket', 'chromium-luci', |
48 '-d', luci_go_dir.join('mac64')]) | 48 '-d', luci_go_dir.join('mac64')]) |
49 self.m.step('download luci-go win', | 49 self.m.step('download luci-go win', |
50 ['download_from_google_storage', '--no_resume', | 50 ['download_from_google_storage', '--no_resume', |
51 '--platform=win32', '--no_auth', '--bucket', 'chromium-luci', | 51 '--platform=win32', '--no_auth', '--bucket', 'chromium-luci', |
52 '-d', luci_go_dir.join('win64')]) | 52 '-d', luci_go_dir.join('win64')]) |
53 # Copy binaries to the expected location. | 53 # Copy binaries to the expected location. |
54 dest = self.m.infra_paths['slave_build'].join('luci-go') | 54 dest = self.m.path['slave_build'].join('luci-go') |
55 self.m.file.rmtree('Go binary dir', dest) | 55 self.m.file.rmtree('Go binary dir', dest) |
56 self.m.file.copytree('Copy Go binary', | 56 self.m.file.copytree('Copy Go binary', |
57 source=luci_go_dir, | 57 source=luci_go_dir, |
58 dest=dest) | 58 dest=dest) |
59 | 59 |
60 def isolate_and_trigger_task( | 60 def isolate_and_trigger_task( |
61 self, isolate_path, isolate_base_dir, task_name, isolate_vars, | 61 self, isolate_path, isolate_base_dir, task_name, isolate_vars, |
62 swarm_dimensions, isolate_blacklist=None, extra_isolate_hashes=None, | 62 swarm_dimensions, isolate_blacklist=None, extra_isolate_hashes=None, |
63 idempotent=False, store_output=True, extra_args=None, expiration=None, | 63 idempotent=False, store_output=True, extra_args=None, expiration=None, |
64 hard_timeout=None, io_timeout=None): | 64 hard_timeout=None, io_timeout=None): |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 def collect_swarming_task_isolate_hash(self, swarming_task): | 229 def collect_swarming_task_isolate_hash(self, swarming_task): |
230 """Wait for the given swarming task to finish and return its output hash. | 230 """Wait for the given swarming task to finish and return its output hash. |
231 | 231 |
232 Args: | 232 Args: |
233 swarming_task: An instance of swarming.SwarmingTask. | 233 swarming_task: An instance of swarming.SwarmingTask. |
234 Returns: | 234 Returns: |
235 the hash of the isolate output of the task. | 235 the hash of the isolate output of the task. |
236 """ | 236 """ |
237 res = self.collect_swarming_task(swarming_task) | 237 res = self.collect_swarming_task(swarming_task) |
238 return res.json.output['shards'][0]['isolated_out']['isolated'] | 238 return res.json.output['shards'][0]['isolated_out']['isolated'] |
OLD | NEW |