diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 18 | ||||
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 13 |
2 files changed, 19 insertions, 12 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 5a6dcd72f6..bb921fc98e 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -120,6 +120,24 @@ class Build(models.Model): | |||
120 | build_name = models.CharField(max_length=100) | 120 | build_name = models.CharField(max_length=100) |
121 | bitbake_version = models.CharField(max_length=50) | 121 | bitbake_version = models.CharField(max_length=50) |
122 | 122 | ||
123 | def completeper(self): | ||
124 | tf = Task.objects.filter(build = self) | ||
125 | tfc = tf.count() | ||
126 | if tfc > 0: | ||
127 | completeper = tf.exclude(order__isnull=True).count()*100/tf.count() | ||
128 | else: | ||
129 | completeper = 0 | ||
130 | return completeper | ||
131 | |||
132 | def eta(self): | ||
133 | from django.utils import timezone | ||
134 | eta = 0 | ||
135 | completeper = self.completeper() | ||
136 | if self.completeper() > 0: | ||
137 | eta = timezone.now() + ((timezone.now() - self.started_on)*(100-completeper)/completeper) | ||
138 | return eta | ||
139 | |||
140 | |||
123 | def get_sorted_target_list(self): | 141 | def get_sorted_target_list(self): |
124 | tgts = Target.objects.filter(build_id = self.id).order_by( 'target' ); | 142 | tgts = Target.objects.filter(build_id = self.id).order_by( 'target' ); |
125 | return( tgts ); | 143 | return( tgts ); |
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index e68f8b002f..86a34adf24 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -224,17 +224,6 @@ def builds(request): | |||
224 | 224 | ||
225 | # build view-specific information; this is rendered specifically in the builds page, at the top of the page (i.e. Recent builds) | 225 | # build view-specific information; this is rendered specifically in the builds page, at the top of the page (i.e. Recent builds) |
226 | build_mru = Build.objects.filter(completed_on__gte=(timezone.now()-timedelta(hours=24))).order_by("-started_on")[:3] | 226 | build_mru = Build.objects.filter(completed_on__gte=(timezone.now()-timedelta(hours=24))).order_by("-started_on")[:3] |
227 | for b in [ x for x in build_mru if x.outcome == Build.IN_PROGRESS ]: | ||
228 | tf = Task.objects.filter(build = b) | ||
229 | tfc = tf.count() | ||
230 | if tfc > 0: | ||
231 | b.completeper = tf.exclude(order__isnull=True).count()*100/tf.count() | ||
232 | else: | ||
233 | b.completeper = 0 | ||
234 | |||
235 | b.eta = 0 | ||
236 | if b.completeper > 0: | ||
237 | b.eta = timezone.now() + ((timezone.now() - b.started_on)*(100-b.completeper)/b.completeper) | ||
238 | 227 | ||
239 | # set up list of fstypes for each build | 228 | # set up list of fstypes for each build |
240 | fstypes_map = {}; | 229 | fstypes_map = {}; |
@@ -1854,7 +1843,7 @@ if toastermain.settings.MANAGED: | |||
1854 | context = { | 1843 | context = { |
1855 | "project" : prj, | 1844 | "project" : prj, |
1856 | #"buildrequests" : prj.buildrequest_set.filter(state=BuildRequest.REQ_QUEUED), | 1845 | #"buildrequests" : prj.buildrequest_set.filter(state=BuildRequest.REQ_QUEUED), |
1857 | "buildrequests" : map(lambda x: (x, {"machine" : x.brvariable_set.filter(name="MACHINE")[0]}), prj.buildrequest_set.order_by("-pk")), | 1846 | "buildrequests" : map(lambda x: (x, {"machine" : x.brvariable_set.filter(name="MACHINE")[0]}), prj.buildrequest_set.filter(state__lt = BuildRequest.REQ_INPROGRESS).order_by("-pk")), |
1858 | "builds" : prj.build_set.all(), | 1847 | "builds" : prj.build_set.all(), |
1859 | "puser": puser, | 1848 | "puser": puser, |
1860 | } | 1849 | } |