Chromium Code Reviews| 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
|