def get_test_status(test_id): """Retrieve the status for a test""" try: status = db.get_test_status(test_id) return jsonify({'status':status}) except UnknownTestError: return make_response(jsonify({'error':'Unknown Test {test_id}.'.format(test_id=test_id)}), 404)
def get_series_summaries_impl(series, start_timestamp, end_timestamp): series = db.get_series(series, start_timestamp, end_timestamp) summaries = [] for test_id in series: status = db.get_test_status(test_id) if status == 'completed': artifact = db.get_test_artifact_data(test_id, 'stats_summary', 'stats_summary.{}.json'.format(test_id)) if artifact and artifact[0]: summaries.append(json.loads(artifact[0])) return summaries
def get_series(series, start_timestamp, end_timestamp): series = db.get_series(series, start_timestamp, end_timestamp) # barf -- like below this sucks -- changing the series table to include status needs to be done valid_jobs = [job_id for job_id in series if db.get_test_status(job_id) == "completed"] jsobj = {"series": valid_jobs} if "true" == request.args.get("pretty", "True").lower(): response = json.dumps(obj=jsobj, sort_keys=True, indent=4, separators=(",", ": ")) else: response = json.dumps(obj=jsobj) return Response(response=response, status=200, mimetype="application/json")
def get_series( series, start_timestamp, end_timestamp): series = db.get_series( series, start_timestamp, end_timestamp) # barf -- like below this sucks -- changing the series table to include status needs to be done valid_jobs = [job_id for job_id in series if db.get_test_status(job_id) == 'completed'] jsobj = {'series': valid_jobs} if 'true' == request.args.get('pretty', 'True').lower(): response = json.dumps(obj=jsobj, sort_keys=True, indent=4, separators=(',', ': ')) else: response = json.dumps(obj=jsobj) return Response(response=response, status=200, mimetype='application/json')