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

Unified Diff: scripts/slave/recipe_modules/swarming/resources/collect_gtest_task.py

Issue 2372713003: Reland of Size limit gtest collect (Closed)
Patch Set: Fix size limit. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/recipe_modules/swarming/resources/collect_gtest_task.py
diff --git a/scripts/slave/recipe_modules/swarming/resources/collect_gtest_task.py b/scripts/slave/recipe_modules/swarming/resources/collect_gtest_task.py
index cd82d3b1955c1a3f7debfabf33d5ee75ff4ca6de..76c1db6c3de51765074c821e960a5a93bedbd393 100755
--- a/scripts/slave/recipe_modules/swarming/resources/collect_gtest_task.py
+++ b/scripts/slave/recipe_modules/swarming/resources/collect_gtest_task.py
@@ -95,11 +95,19 @@ def merge_shard_results(output_dir):
return merged
+# 100 MB
+OUTPUT_JSON_SIZE_LIMIT = 100 * 1024 * 1024
+
+
def load_shard_json(output_dir, index):
"""Reads JSON output of a single shard."""
# 'output.json' is set in swarming/api.py, gtest_task method.
path = os.path.join(output_dir, str(index), 'output.json')
try:
+ filesize = os.stat(path).st_size
+ if filesize > OUTPUT_JSON_SIZE_LIMIT:
Vadim Sh. 2016/09/27 00:10:56 please log this to stderr
+ raise ValueError()
+
with open(path) as f:
return json.load(f)
except (IOError, ValueError):
Vadim Sh. 2016/09/27 00:10:56 catch OSError here, since os.stat can raise it now
« 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