Bug 1516456 - adjust writeruntimes.py to work with latest activedata. r=bc
authorJoel Maher <jmaher@mozilla.com>
Wed, 26 Dec 2018 19:35:30 +0000
changeset 509053 5acb5351293872f27da4f957707a14a6ee0f311d
parent 509052 0e9a610fe05f5e830d4cc387b6d293e94347e3c7
child 509054 370233ced43e10a2398713ed2dcc3d4a6011bf55
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbc
bugs1516456
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1516456 - adjust writeruntimes.py to work with latest activedata. r=bc adjust writeruntimes.py to work with latest activedata Differential Revision: https://phabricator.services.mozilla.com/D15391
testing/runtimes/writeruntimes.py
--- a/testing/runtimes/writeruntimes.py
+++ b/testing/runtimes/writeruntimes.py
@@ -1,42 +1,47 @@
 #!/usr/bin/env python
 from argparse import ArgumentParser
 from collections import defaultdict
+import datetime
 import json
 import os
 import sys
+import time
 
 import requests
 
 here = os.path.abspath(os.path.dirname(__file__))
 
-ACTIVE_DATA_URL = "http://activedata.allizom.org/query"
+ACTIVE_DATA_URL = "https://activedata.allizom.org/query"
 PERCENTILE = 0.5 # ignore the bottom PERCENTILE*100% of numbers
 
 def query_activedata(suite, e10s, platforms=None):
     platforms = ', "build.platform":%s' % json.dumps(platforms) if platforms else ''
 
+    last_week = datetime.datetime.now() - datetime.timedelta(days=7)
+    last_week_timestamp = time.mktime(last_week.timetuple())
+
     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":{"run.suite":"%s"%s}},
         {%s},
-        {"gt":{"run.timestamp":"{{today-week}}"}}
+        {"gt":{"run.timestamp":%s}}
     ]}
 }
-""" % (suite, platforms, e10s_clause)
+""" % (suite, platforms, e10s_clause, last_week_timestamp)
 
     response = requests.post(ACTIVE_DATA_URL,
                              data=query,
                              stream=True)
     response.raise_for_status()
     data = response.json()["data"]
     return data
 
@@ -124,12 +129,16 @@ def cli(args=sys.argv[1:]):
     if args.platforms:
         args.platforms = args.platforms.split(',')
 
     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 not data:
+        print("Not creating runtimes file as no data was found")
+    else:
+        write_runtimes(data, suite, indir=args.indir, outdir=args.outdir)
 
 if __name__ == "__main__":
     sys.exit(cli())