| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 """Provides API wrapper for FindIt""" |
| 6 |
| 7 from endpoints import endpoints |
| 8 |
| 9 |
| 10 class FindItAPI(object): |
| 11 """A wrapper around the FindIt api.""" |
| 12 def __init__(self): |
| 13 self.client = endpoints.build_client( |
| 14 'findit', 'v1', 'https://findit-for-me.appspot.com/_ah/api/discovery/v1' |
| 15 '/apis/{api}/{apiVersion}/rest') |
| 16 |
| 17 def flake(self, flake, flaky_runs): |
| 18 body = {} |
| 19 body['name'] = flake.name |
| 20 body['is_step'] = flake.is_step |
| 21 body['bug_id'] = flake.issue_id |
| 22 body['build_steps'] = [] |
| 23 for flaky_run in flaky_runs: |
| 24 failure_run = flaky_run.failure_run.get() |
| 25 patchset_build_run = failure_run.parent.get() |
| 26 for occurrence in flaky_run.flakes: |
| 27 body['build_steps'].append({ |
| 28 'master_name': patchset_build_run.master, |
| 29 'builder_name': patchset_build_run.builder, |
| 30 'build_number': failure_run.buildnumber, |
| 31 'step_name': occurrence.name |
| 32 }) |
| 33 endpoints.retry_request(self.client.flake(body=body)) |
| OLD | NEW |