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

Side by Side Diff: scripts/slave/recipe_modules/disk/api.py

Issue 1917243002: Revert "build: roll infra_paths changes" (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 7 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 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 from recipe_engine import recipe_api 5 from recipe_engine import recipe_api
6 6
7 7
8 class DiskApi(recipe_api.RecipeApi): 8 class DiskApi(recipe_api.RecipeApi):
9 """DiskApi contains helper functions for reading disk info.""" 9 """DiskApi contains helper functions for reading disk info."""
10 10
(...skipping 12 matching lines...) Expand all
23 mark the step as WARNING. Defaults to 0.9. 23 mark the step as WARNING. Defaults to 0.9.
24 previous_result (dict): previous result of space_usage call. If passed, 24 previous_result (dict): previous result of space_usage call. If passed,
25 delta is displayed in step text. 25 delta is displayed in step text.
26 name (str): step name. Defaults to "disk space usage". 26 name (str): step name. Defaults to "disk space usage".
27 27
28 Returns: 28 Returns:
29 A dict with disk usage info or None if step fails. Dict keys: 29 A dict with disk usage info or None if step fails. Dict keys:
30 * capacity (float): disk capacity, in MiB. 30 * capacity (float): disk capacity, in MiB.
31 * used (float): disk usage, in MiB. 31 * used (float): disk usage, in MiB.
32 """ 32 """
33 path = path or self.m.infra_paths['slave_build'] 33 path = path or self.m.path['slave_build']
34 name = name or 'disk space usage' 34 name = name or 'disk space usage'
35 warning_level = warning_level or 0.9 35 warning_level = warning_level or 0.9
36 kwargs.setdefault( 36 kwargs.setdefault(
37 'step_test_data', 37 'step_test_data',
38 lambda: self.m.json.test_api.output_stream( 38 lambda: self.m.json.test_api.output_stream(
39 self.test_api.space_usage_result())) 39 self.test_api.space_usage_result()))
40 40
41 if self.m.platform.is_win: 41 if self.m.platform.is_win:
42 # Not supported. Feel free to implement. 42 # Not supported. Feel free to implement.
43 return 43 return
(...skipping 22 matching lines...) Expand all
66 } 66 }
67 except Exception as ex: 67 except Exception as ex:
68 # Do not fail entire build because of a disk space step failure. 68 # Do not fail entire build because of a disk space step failure.
69 if step: 69 if step:
70 step.presentation.logs['exception'] = ['%r' % ex] 70 step.presentation.logs['exception'] = ['%r' % ex]
71 step.presentation.status = self.m.step.WARNING 71 step.presentation.status = self.m.step.WARNING
72 if can_fail_build: 72 if can_fail_build:
73 raise recipe_api.StepFailure('Could not get disk info: %s' % ex) 73 raise recipe_api.StepFailure('Could not get disk info: %s' % ex)
74 return 74 return
75 75
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/disk/__init__.py ('k') | scripts/slave/recipe_modules/disk/example.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698