OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import webapp2 | 5 import webapp2 |
6 | 6 |
7 from dashboard.pinpoint.models import change | 7 from dashboard.pinpoint.models import change |
8 from dashboard.pinpoint.models import job as job_module | 8 from dashboard.pinpoint.models import job as job_module |
9 | 9 |
10 | 10 |
11 class New(webapp2.RequestHandler): | 11 class New(webapp2.RequestHandler): |
12 """Handler that cooks up a fresh Pinpoint job.""" | 12 """Handler that cooks up a fresh Pinpoint job.""" |
13 | 13 |
14 def post(self): | 14 def post(self): |
15 """Start a new Pinpoint job.""" | 15 """Start a new Pinpoint job.""" |
16 | 16 |
17 # TODO(dtu): Read the parameters from the request object. | 17 # TODO(dtu): Read the parameters from the request object. |
18 # Not doing it for now because it's easier to run tests this way. | 18 # Not doing it for now because it's easier to run tests this way. |
19 configuration = 'Mac Pro 10.11 Perf' | 19 configuration = 'Mac Pro 10.11 Perf' |
20 test_suite = 'speedometer' | 20 test_suite = 'speedometer' |
21 test = None | 21 test = None |
22 metric = None | 22 metric = None |
23 auto_explore = True | 23 auto_explore = True |
| 24 bug_id = None |
24 | 25 |
25 change_1 = { | 26 change_1 = { |
26 'base_commit': { | 27 'base_commit': { |
27 'repository': 'src', | 28 'repository': 'src', |
28 'git_hash': '2c1f8ed028edcb44c954cb2a0625a8f278933481', | 29 'git_hash': '2c1f8ed028edcb44c954cb2a0625a8f278933481', |
29 } | 30 } |
30 } | 31 } |
31 change_2 = { | 32 change_2 = { |
32 'base_commit': { | 33 'base_commit': { |
33 'repository': 'src', | 34 'repository': 'src', |
(...skipping 13 matching lines...) Expand all Loading... |
47 return | 48 return |
48 | 49 |
49 # Convert parameters to canonical internal representation. | 50 # Convert parameters to canonical internal representation. |
50 | 51 |
51 # Create job. | 52 # Create job. |
52 job = job_module.Job.New( | 53 job = job_module.Job.New( |
53 configuration=configuration, | 54 configuration=configuration, |
54 test_suite=test_suite, | 55 test_suite=test_suite, |
55 test=test, | 56 test=test, |
56 metric=metric, | 57 metric=metric, |
57 auto_explore=auto_explore) | 58 auto_explore=auto_explore, |
| 59 bug_id=bug_id) |
58 | 60 |
59 # Add changes. | 61 # Add changes. |
60 for c in changes: | 62 for c in changes: |
61 job.AddChange(c) | 63 job.AddChange(c) |
62 | 64 |
63 # Put job into datastore. | 65 # Put job into datastore. |
64 job_id = job.put().urlsafe() | 66 job_id = job.put().urlsafe() |
65 | 67 |
66 # Start job. | 68 # Start job. |
67 job.Start() | 69 job.Start() |
68 job.put() | 70 job.put() |
69 | 71 |
70 self.response.write(job_id) | 72 self.response.write(job_id) |
OLD | NEW |