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

Unified Diff: telemetry/telemetry/internal/story_runner.py

Issue 1806023002: [Telemetry] Re-add API to tear down state after each story run (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: fix test Created 4 years, 9 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
Index: telemetry/telemetry/internal/story_runner.py
diff --git a/telemetry/telemetry/internal/story_runner.py b/telemetry/telemetry/internal/story_runner.py
index 18fb8966497821cfb4b34f7f4bfcdcef27c0e106..f975ca3ef81f8dd5db151aeaccddb1f8c15f45a2 100644
--- a/telemetry/telemetry/internal/story_runner.py
+++ b/telemetry/telemetry/internal/story_runner.py
@@ -171,7 +171,8 @@ def StoriesGroupedByStateClass(story_set, allow_multiple_groups):
return story_groups
-def Run(test, story_set, finder_options, results, max_failures=None):
+def Run(test, story_set, finder_options, results, max_failures=None,
+ should_tear_down_state_after_each_story_run=False):
"""Runs a given test against a given page_set with the given options.
Stop execution for unexpected exceptions such as KeyboardInterrupt.
@@ -211,8 +212,12 @@ def Run(test, story_set, finder_options, results, max_failures=None):
for story in group.stories:
for _ in xrange(finder_options.page_repeat):
if not state:
+ # Construct shared state by using a copy of finder_options. Shared
+ # state may update the finder_options. If we tear down the shared
+ # state after this story run, we want to construct the shared
+ # state for the next story from the original finder_options.
state = group.shared_state_class(
- test, finder_options, story_set)
+ test, finder_options.Copy(), story_set)
results.WillRunPage(story)
try:
_WaitForThermalThrottlingIfNeeded(state.platform)
@@ -240,6 +245,9 @@ def Run(test, story_set, finder_options, results, max_failures=None):
# Print current exception and propagate existing exception.
exception_formatter.PrintFormattedException(
msg='Exception from result processing:')
+ if state and should_tear_down_state_after_each_story_run:
+ state.TearDownState()
+ state = None
if (effective_max_failures is not None and
len(results.failures) > effective_max_failures):
logging.error('Too many failures. Aborting.')
@@ -299,7 +307,8 @@ def RunBenchmark(benchmark, finder_options):
benchmark_metadata, finder_options,
benchmark.ValueCanBeAddedPredicate) as results:
try:
- Run(pt, stories, finder_options, results, benchmark.max_failures)
+ Run(pt, stories, finder_options, results, benchmark.max_failures,
+ benchmark.ShouldTearDownStateAfterEachStoryRun())
return_code = min(254, len(results.failures))
except Exception:
exception_formatter.PrintFormattedException()

Powered by Google App Engine
This is Rietveld 408576698