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

Unified Diff: tools/android/loading/sandwich.py

Issue 1872313002: sandwich: Implement SandwichTaskBuilder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses pasko's comments and adds support for the different sub-resources discovrers Created 4 years, 8 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: tools/android/loading/sandwich.py
diff --git a/tools/android/loading/sandwich.py b/tools/android/loading/sandwich.py
index 5f61aac31553afeed8eae0be89f4372c147ed7e0..5c76b1d44426ac252e6240dbbfd934bfb00156e8 100755
--- a/tools/android/loading/sandwich.py
+++ b/tools/android/loading/sandwich.py
@@ -35,6 +35,8 @@ import options
import sandwich_metrics
import sandwich_misc
from sandwich_runner import SandwichRunner
+import sandwich_tasks
+import task_manager
from trace_test.webserver_test import WebServer
@@ -49,6 +51,8 @@ def _ArgumentParser():
common_job_parser.add_argument('--job', required=True,
help='JSON file with job description.')
+ orchestra_parser = task_manager.CommandLineParser()
+
# Plumbing parser to configure OPTIONS.
plumbing_parser = OPTIONS.GetParentParser('plumbing options')
@@ -166,6 +170,21 @@ def _ArgumentParser():
record_trace_parser.add_argument('-o', '--output', type=str, required=True,
help='Output path of the generated trace.')
+ # Run all subcommand.
+ run_all = subparsers.add_parser('run-all',
+ parents=[common_job_parser, orchestra_parser],
+ help='Run all steps using the task manager '
+ 'infrastructure.')
+ run_all.add_argument('-g', '--gen-full', action='store_true',
+ help='Generate the full graph with all possible'
+ 'benchmarks.')
+ run_all.add_argument('--wpr-archive', default=None, type=str,
+ dest='wpr_archive_path',
+ help='WebPageReplay archive to use, instead of '
+ 'generating one.')
+ run_all.add_argument('--url-repeat', default=1, type=int,
+ help='How many times to repeat the urls.')
+
return parser
@@ -244,6 +263,35 @@ def _RecordWebServerTestTrace(args):
return 0
+def _RunAllMain(args):
+ builder = sandwich_tasks.SandwichTaskBuilder(
+ output_directory=args.output,
+ job_path=args.job,
+ url_repeat=args.url_repeat)
+ if args.wpr_archive_path:
+ builder.OverridePathToWprArchive(args.wpr_archive_path)
+ else:
+ builder.PopulateWprRecordingTask()
+ builder.PopulateCommonPipelines()
+ builder.PopulateLoadBenchmark(sandwich_misc.DISABLED_DISCOVERER)
+ builder.PopulateLoadBenchmark(sandwich_misc.FULLCACHE_DISCOVERER)
+
+ if args.gen_full:
+ for subresources_discoverer in sandwich_misc.SUBRESOURCE_DISCOVERERS:
pasko 2016/04/14 12:34:42 s/subresources_discoverer/subresource_discoverer/
gabadie 2016/04/14 15:43:32 Done.
+ if subresources_discoverer == sandwich_misc.FULLCACHE_DISCOVERER:
+ continue
+ for network_condition in ['Regular4G', 'Regular3G', 'Regular2G']:
+ runner_transformer_name = network_condition.lower()
+ runner_transformer = sandwich_tasks.NetworkSimulationTransformer(
+ network_condition)
+ builder.PopulateLoadBenchmark(subresources_discoverer,
+ runner_transformer_name,
+ runner_transformer)
+
+ return task_manager.ExecuteWithCommandLine(
+ args, builder.tasks.values(), builder.default_final_tasks)
+
+
def main(command_line_args):
logging.basicConfig(level=logging.INFO)
devil_chromium.Initialize()
@@ -266,6 +314,8 @@ def main(command_line_args):
return _FilterCacheMain(args)
if args.subcommand == 'record-test-trace':
return _RecordWebServerTestTrace(args)
+ if args.subcommand == 'run-all':
+ return _RunAllMain(args)
assert False

Powered by Google App Engine
This is Rietveld 408576698