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

Unified Diff: scripts/slave/recipe_modules/auto_bisect_staging/api.py

Issue 2481883002: Create copies of the benchmark output for catapult to read. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/auto_bisect_staging/example.expected/basic_bisect_other_direction.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/recipe_modules/auto_bisect_staging/api.py
diff --git a/scripts/slave/recipe_modules/auto_bisect_staging/api.py b/scripts/slave/recipe_modules/auto_bisect_staging/api.py
index 31d0529efe5f6c8989ba80e584c3428720d41aa4..412c4e7be1436feca9d7fba96aa69d8b5f75bdcb 100644
--- a/scripts/slave/recipe_modules/auto_bisect_staging/api.py
+++ b/scripts/slave/recipe_modules/auto_bisect_staging/api.py
@@ -410,8 +410,11 @@ class AutoBisectStagingApi(recipe_api.RecipeApi):
well as details about each sample ('debug_values', 'mean' and 'std_dev').
"""
- args = [','.join(map(str, values_a)),
- ','.join(map(str, values_b)),
+ values_a = self._make_copies(values_a)
+ values_b = self._make_copies(values_b)
+
+ args = [','.join(values_a),
+ ','.join(values_b),
metric,
'--' + output_format]
@@ -423,3 +426,24 @@ class AutoBisectStagingApi(recipe_api.RecipeApi):
args=args,
stdout=self.m.json.output(),
**kwargs).stdout
+
+ def _make_copies(self, files):
+ """Creates a copy of each file making sure to close the file handle.
+
+ The reason why we need this is to allow compare_samples to open the files.
+ An issue with this is suspected to cause http://crbug.com/659908
+
+ Args:
+ files: A list of strings or Path objects.
+
+ Returns:
+ A list of paths as strings.
+ """
+ copy_paths = []
+ for path in files:
+ new_path = str(path) + '.copy'
+ if not self._test_data.enabled: # pragma: no cover
+ with open(new_path, 'w') as f:
+ f.write(open(str(path)).read())
dtu 2016/11/07 19:34:24 shutil.copyfile()?
+ copy_paths.append(new_path)
+ return copy_paths
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/auto_bisect_staging/example.expected/basic_bisect_other_direction.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698