def get(self): self.response.headers['Content-Type'] = 'application/json' test_id, branch_id, platform_id = _get_test_branch_platform_ids(self) runs = Runs.json_by_ids(branch_id, platform_id, test_id) if runs: self.response.out.write(runs) elif model_from_numeric_id(branch_id, Branch) and model_from_numeric_id(platform_id, Platform) and model_from_numeric_id(test_id, Test): schedule_runs_update(test_id, branch_id, platform_id)
def test_model_from_numeric_id(self): def execute(id): return Branch(id=id, name='some branch', key_name='some-branch').put() branch = Branch.get(create_in_transaction_with_numeric_id_holder(execute)) self.assertEqual(model_from_numeric_id(branch.id, Branch).key(), branch.key()) self.assertEqual(model_from_numeric_id(branch.id + 1, Branch), None) delete_model_with_numeric_id_holder(branch) self.assertEqual(model_from_numeric_id(branch.id, Branch), None)
def post(self): self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' test_id, branch_id, platform_id = _get_test_branch_platform_ids(self) branch = model_from_numeric_id(branch_id, Branch) platform = model_from_numeric_id(platform_id, Platform) test = model_from_numeric_id(test_id, Test) assert branch assert platform assert test Runs.update_or_insert(branch, platform, test) self.response.out.write('OK')
def post(self): self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' test_id, branch_id, platform_id = _get_test_branch_platform_ids(self) branch = model_from_numeric_id(branch_id, Branch) platform = model_from_numeric_id(platform_id, Platform) test = model_from_numeric_id(test_id, Test) assert branch assert platform assert test PersistentCache.set_cache(Test.cache_key(test_id, branch_id, platform_id), Runs(branch, platform, test.name).to_json()) self.response.out.write('OK')
def post(self): self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' test_id, branch_id, platform_id = _get_test_branch_platform_ids(self) branch = model_from_numeric_id(branch_id, Branch) platform = model_from_numeric_id(platform_id, Platform) test = model_from_numeric_id(test_id, Test) display_days = int(self.request.get('displayDays')) assert branch assert platform assert test params = Runs(branch, platform, test.name).chart_params(display_days) dashboard_chart_file = urllib.urlopen('http://chart.googleapis.com/chart', urllib.urlencode(params)) DashboardImage.create(branch.id, platform.id, test.id, display_days, dashboard_chart_file.read())
def post(self): return self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' test_id, branch_id, platform_id = _get_test_branch_platform_ids(self) branch = model_from_numeric_id(branch_id, Branch) platform = model_from_numeric_id(platform_id, Platform) test = model_from_numeric_id(test_id, Test) display_days = int(self.request.get('displayDays')) assert branch assert platform assert test params = Runs.get_by_objects(branch, platform, test).chart_params(display_days) if not params: return dashboard_chart_file = urllib.urlopen('http://chart.googleapis.com/chart', urllib.urlencode(params)) DashboardImage.create(branch.id, platform.id, test.id, display_days, dashboard_chart_file.read())
def post(self): self.response.headers["Content-Type"] = "text/plain; charset=utf-8" test_id, branch_id, platform_id = _get_test_branch_platform_ids(self) branch = model_from_numeric_id(branch_id, Branch) platform = model_from_numeric_id(platform_id, Platform) test = model_from_numeric_id(test_id, Test) display_days = int(self.request.get("displayDays")) assert branch assert platform assert test params = Runs.update_or_insert(branch, platform, test).chart_params(display_days) if not params: return dashboard_chart_file = urllib.urlopen("http://chart.googleapis.com/chart", urllib.urlencode(params)) DashboardImage.create(branch.id, platform.id, test.id, display_days, dashboard_chart_file.read())
def post(self): self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' try: test_id = int(self.request.get('id', 0)) branch_id = int(self.request.get('branchid', 0)) platform_id = int(self.request.get('platformid', 0)) except TypeError: # FIXME: Output an error here test_id = 0 branch_id = 0 platform_id = 0 # FIXME: Just fetch builds specified by "days" # days = self.request.get('days', 365) builds = Build.all() builds.filter('branch =', model_from_numeric_id(branch_id, Branch)) builds.filter('platform =', model_from_numeric_id(platform_id, Platform)) test = model_from_numeric_id(test_id, Test) test_name = test.name if test else None test_runs = [] averages = {} values = [] timestamps = [] for build in builds: results = TestResult.all() results.filter('name =', test_name) results.filter('build =', build) for result in results: builderId = build.builder.key().id() posixTimestamp = mktime(build.timestamp.timetuple()) statistics = None supplementary_revisions = None if result.valueStdev != None and result.valueMin != None and result.valueMax != None: statistics = {'stdev': result.valueStdev, 'min': result.valueMin, 'max': result.valueMax} if build.chromiumRevision != None: supplementary_revisions = {'Chromium': build.chromiumRevision} test_runs.append([result.key().id(), [build.key().id(), build.buildNumber, build.revision, supplementary_revisions], posixTimestamp, result.value, 0, # runNumber [], # annotations builderId, statistics]) # FIXME: Calculate the average; in practice, we wouldn't have more than one value for a given revision averages[build.revision] = result.value values.append(result.value) timestamps.append(posixTimestamp) result = json.dumps({ 'test_runs': test_runs, 'averages': averages, 'min': min(values) if values else None, 'max': max(values) if values else None, 'date_range': [min(timestamps), max(timestamps)] if timestamps else None, 'stat': 'ok'}) cache_runs(test_id, branch_id, platform_id, result) self.response.out.write('OK')