[LNT] r224737 - Add machine overview page in JSON format.
Michael Zolotukhin
mzolotukhin at apple.com
Mon Dec 22 13:55:32 PST 2014
Author: mzolotukhin
Date: Mon Dec 22 15:55:32 2014
New Revision: 224737
URL: http://llvm.org/viewvc/llvm-project?rev=224737&view=rev
Log:
Add machine overview page in JSON format.
Modified:
lnt/trunk/lnt/server/ui/views.py
lnt/trunk/tests/server/ui/V4Pages.py
Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=224737&r1=224736&r2=224737&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Mon Dec 22 15:55:32 2014
@@ -172,6 +172,26 @@ def v4_machine(id):
order_by(ts.Run.start_time.desc()))
associated_runs = associated_runs.items()
associated_runs.sort()
+ if request.args.get('json'):
+ json_obj = dict()
+ machine_obj = ts.query(ts.Machine).filter(ts.Machine.id == id).one()
+ json_obj['name'] = machine_obj.name
+ json_obj['id'] = machine_obj.id
+ runs = {}
+ tests = {}
+ for sample in ts.query(ts.Sample).filter(ts.Run.machine_id == id).all():
+ tests[sample.test.id] = sample.test.name
+ runs[sample.run.id] = (sample.run.order.llvm_project_revision,
+ sample.run.start_time,
+ sample.run.end_time)
+ json_obj['tests'] = []
+ for test_id in tests:
+ json_obj['tests'].append((test_id, tests[test_id]))
+ json_obj['runs'] = []
+ for run_id in runs:
+ (rev, start, end) = runs[run_id]
+ json_obj['runs'].append((run_id, rev, start, end))
+ return flask.jsonify(**json_obj)
return render_template("v4_machine.html",
testsuite_name=g.testsuite_name, id=id,
Modified: lnt/trunk/tests/server/ui/V4Pages.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/ui/V4Pages.py?rev=224737&r1=224736&r2=224737&view=diff
==============================================================================
--- lnt/trunk/tests/server/ui/V4Pages.py (original)
+++ lnt/trunk/tests/server/ui/V4Pages.py Mon Dec 22 15:55:32 2014
@@ -38,6 +38,9 @@ def main():
# Get a machine overview page.
check_code(client, '/v4/nts/machine/1')
+ # Get a machine overview page in JSON format.
+ check_code(client, '/v4/nts/machine/1?json=true')
+
# Get the order summary page.
check_code(client, '/v4/nts/all_orders')
More information about the llvm-commits
mailing list