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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Joel Maher 2018-12-26 19:35:30 +00:00
Родитель 5535070e5b
Коммит 185ef35b10
1 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -1,20 +1,25 @@
#!/usr/bin/env python #!/usr/bin/env python
from argparse import ArgumentParser from argparse import ArgumentParser
from collections import defaultdict from collections import defaultdict
import datetime
import json import json
import os import os
import sys import sys
import time
import requests import requests
here = os.path.abspath(os.path.dirname(__file__)) 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 PERCENTILE = 0.5 # ignore the bottom PERCENTILE*100% of numbers
def query_activedata(suite, e10s, platforms=None): def query_activedata(suite, e10s, platforms=None):
platforms = ', "build.platform":%s' % json.dumps(platforms) if platforms else '' 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"}' e10s_clause = '"eq":{"run.type":"e10s"}'
if not e10s: if not e10s:
e10s_clause = '"not":{%s}' % e10s_clause e10s_clause = '"not":{%s}' % e10s_clause
@ -28,10 +33,10 @@ def query_activedata(suite, e10s, platforms=None):
"where":{"and":[ "where":{"and":[
{"eq":{"run.suite":"%s"%s}}, {"eq":{"run.suite":"%s"%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, response = requests.post(ACTIVE_DATA_URL,
data=query, data=query,
@ -129,6 +134,10 @@ def cli(args=sys.argv[1:]):
suite = args.suite suite = args.suite
if args.e10s: if args.e10s:
suite = '%s-e10s' % suite suite = '%s-e10s' % suite
if not data:
print("Not creating runtimes file as no data was found")
else:
write_runtimes(data, suite, indir=args.indir, outdir=args.outdir) write_runtimes(data, suite, indir=args.indir, outdir=args.outdir)
if __name__ == "__main__": if __name__ == "__main__":