Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: dashboard/dashboard/pinpoint/models/attempt.py

Issue 3001163002: Pinpoint - Surface info from executions for display in UI. (Closed)
Patch Set: Rebase again. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | dashboard/dashboard/pinpoint/models/job.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 class Attempt(object): 6 class Attempt(object):
7 """One run of all the Quests on a Change. 7 """One run of all the Quests on a Change.
8 8
9 Each Change should execute at least one Attempt. The user can request more 9 Each Change should execute at least one Attempt. The user can request more
10 runs, which creates additional Attempts. The bisect algorithm may also create 10 runs, which creates additional Attempts. The bisect algorithm may also create
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 @property 45 @property
46 def result_values(self): 46 def result_values(self):
47 assert self.completed 47 assert self.completed
48 return dict((quest, execution.result_values) 48 return dict((quest, execution.result_values)
49 for quest, execution in zip(self._quests, self._executions)) 49 for quest, execution in zip(self._quests, self._executions))
50 50
51 @property 51 @property
52 def _last_execution(self): 52 def _last_execution(self):
53 return self._executions[-1] 53 return self._executions[-1]
54 54
55 def AsDict(self):
56 return {'executions': [e.AsDict() for e in self._executions]}
57
55 def ScheduleWork(self): 58 def ScheduleWork(self):
56 """Run this Attempt and update its status.""" 59 """Run this Attempt and update its status."""
57 assert not self.completed 60 assert not self.completed
58 61
59 self._StartNextExecutionIfReady() 62 self._StartNextExecutionIfReady()
60 self._Poll() 63 self._Poll()
61 64
62 def _Poll(self): 65 def _Poll(self):
63 """Update the Attempt status.""" 66 """Update the Attempt status."""
64 self._last_execution.Poll() 67 self._last_execution.Poll()
65 68
66 def _StartNextExecutionIfReady(self): 69 def _StartNextExecutionIfReady(self):
67 can_start_next_execution = not self._executions or ( 70 can_start_next_execution = not self._executions or (
68 self._last_execution.completed and not self.completed) 71 self._last_execution.completed and not self.completed)
69 if not can_start_next_execution: 72 if not can_start_next_execution:
70 return 73 return
71 74
72 next_quest = self._quests[len(self._executions)] 75 next_quest = self._quests[len(self._executions)]
73 if self._executions: 76 if self._executions:
74 arguments = self._last_execution.result_arguments 77 arguments = self._last_execution.result_arguments
75 else: 78 else:
76 arguments = {'change': self._change} 79 arguments = {'change': self._change}
77 80
78 self._executions.append(next_quest.Start(**arguments)) 81 self._executions.append(next_quest.Start(**arguments))
OLDNEW
« no previous file with comments | « no previous file | dashboard/dashboard/pinpoint/models/job.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698