Bug 1324047 - Update testing/runtimes/writeruntimes.py for new e10s schema in ActiveData, r?jgriffin draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Mon, 19 Dec 2016 12:09:10 -0500
changeset 451492 df706e9f47bd06e13f07cba97692e2a96f034762
parent 451111 d4b3146a5567a7ddbcdfa5244945db55616cb8d1
child 451493 875e2e839aada3ea5d1210076b66eeeec358bc9f
push id39204
push userahalberstadt@mozilla.com
push dateTue, 20 Dec 2016 14:29:02 +0000
reviewersjgriffin
bugs1324047
milestone53.0a1
Bug 1324047 - Update testing/runtimes/writeruntimes.py for new e10s schema in ActiveData, r?jgriffin At some point ActiveData stopped considering 'e10s' as a separate suite and instead stored this information in the "run.type" field. This updates the writeruntimes.py script and mochitest runtime file resolving accordingly. MozReview-Commit-ID: LSk2q0hafcm
testing/mochitest/runtests.py
testing/runtimes/writeruntimes.py
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -2078,17 +2078,17 @@ toolbar#nav-bar {
         options.profilePath = None
         self.urlOpts = []
 
     def resolve_runtime_file(self, options):
         """
         Return a path to the runtimes file for a given flavor and
         subsuite.
         """
-        template = "mochitest{e10s}-{suite_slug}.runtimes.json"
+        template = "mochitest-{suite_slug}{e10s}.runtimes.json"
         data_dir = os.path.join(SCRIPT_DIR, 'runtimes')
 
         # Determine the suite slug in the runtimes file name
         slug = self.normflavor(options.flavor)
         if slug == 'browser-chrome' and options.subsuite == 'devtools':
             slug = 'devtools-chrome'
         elif slug == 'mochitest':
             slug = 'plain'
--- a/testing/runtimes/writeruntimes.py
+++ b/testing/runtimes/writeruntimes.py
@@ -6,31 +6,36 @@ import sys
 
 import requests
 
 here = os.path.abspath(os.path.dirname(__file__))
 
 ACTIVE_DATA_URL = "http://activedata.allizom.org/query"
 PERCENTILE = 0.5 # ignore the bottom PERCENTILE*100% of numbers
 
-def query_activedata(suite, platforms=None):
+def query_activedata(suite, e10s, platforms=None):
     platforms = ', "build.platform":%s' % json.dumps(platforms) if platforms else ''
 
+    e10s_clause = '"eq":{"run.type":"e10s"}'
+    if not e10s:
+        e10s_clause = '"not":{%s}' % e10s_clause
+
     query = """
 {
     "from":"unittest",
     "limit":200000,
     "groupby":["result.test"],
     "select":{"value":"result.duration","aggregate":"average"},
     "where":{"and":[
-        {"eq":{"suite":"%s"%s}},
+        {"eq":{"run.suite":"%s"%s}},
+        {%s},
         {"gt":{"run.timestamp":"{{today-week}}"}}
     ]}
 }
-""" % (suite, platforms)
+""" % (suite, platforms, e10s_clause)
 
     response = requests.post(ACTIVE_DATA_URL,
                              data=query,
                              stream=True)
     response.raise_for_status()
     data = response.json()["data"]
     return data
 
@@ -100,23 +105,30 @@ def cli(args=sys.argv[1:]):
         default=here, help="Directory from which to read current runtime data.")
 
     parser.add_argument('-p', '--platforms', default=None,
         help="Comma separated list of platforms from which to generate data.")
 
     parser.add_argument('-s', '--suite', dest='suite', default=None,
         help="Suite for which to generate data.")
 
+    parser.add_argument('--disable-e10s', dest='e10s', default=True,
+        action='store_false', help="Generate runtimes for non-e10s tests.")
+
     args = parser.parse_args(args)
 
     if not args.suite:
         raise ValueError("Must specify suite with the -s argument")
     if ',' in args.suite:
         raise ValueError("Passing multiple suites is not supported")
 
     if args.platforms:
         args.platforms = args.platforms.split(',')
 
-    data = query_activedata(args.suite, args.platforms)
-    write_runtimes(data, args.suite, indir=args.indir, outdir=args.outdir)
+    data = query_activedata(args.suite, args.e10s, args.platforms)
+
+    suite = args.suite
+    if args.e10s:
+        suite = '%s-e10s' % suite
+    write_runtimes(data, suite, indir=args.indir, outdir=args.outdir)
 
 if __name__ == "__main__":
     sys.exit(cli())