Skip to contentSkip to conversation

Show custom build dashboard for builds which fail early

PATCH In review Elliot Smith 2 participants 4 messages Mar 21, 2016 – Mar 23, 2016

lore
Share & tools
lore
#0 lore raw

v2 cover Show custom build dashboard for builds which fail early

v2:

Modifications for other templates which were missed in v1, as per Belen's review.

v1:

Builds which fail early at the "build request stage" (i.e. before the BuildStarted event happens) need a custom build dashboard, as they don't have any buildstats data, images, recipes etc., so the links in the left-hand menu are irrelevant.

Hide the build dashboard's left-hand menu if a build failed early (before BuildStarted). Also remove the build time links for the failed builds, as time data is not available.

The state of the build as "started" or not is determined by looking for build variables associated with a build. As these variables are only added at the point when BuildStarted occurs, any Build object without these variables hasn't triggered a BuildStarted event.

(This is something of a work-around; in future we may have more fine-grained states on a build so that we can properly tell its state. When this happens, the Build.started() method could be modified to properly reflect this.)

To test:

1. Start a build with a bad target, e.g. "zzz".
2. When the build fails, go to the dashboard for the build. The left-hand menu should not be visible.
3. Go to the all builds page. The build time for the failed build should not have a hyperlink on it.
4. Start a build with a bad MACHINE variable setting (either modify in project configuration or in conf/toaster.conf).
5. Repeat steps 2 and 3 for the failed build.
6. Start a build with a bad DISTRO variable setting (either modify in project configuration or in conf/toaster.conf).
7. Repeat steps 2 and 3 for the failed build.
8. Start a good build, e.g. "mpfr-native".
9. When the build completes (successfully), go to the dashboard. The left-hand menu should be visible and functioning.
10. Go to the all builds page. Links on the build time should be present and should point at the time page for the build.

Note that I have some Selenium tests for testing these changes, but they depend on a previous patchset which is not yet in toaster-next; see
https://lists.yoctoproject.org/pipermail/toaster/2016-March/004164.html.

Changes since 358ba11b15f5182c4d667cf35565afc0c6ad4126 (toaster-next) are in
git://git.yoctoproject.org/poky-contrib, elliot/toaster/failed_builds_display-8443
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=elliot/toaster/failed_builds_display-8443

Related bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8443

Elliot Smith (2):
toaster: adjust build dashboard for failed builds
toaster: remove links from time field on failed builds

 bitbake/lib/toaster/orm/models.py                  |  15 ++
 bitbake/lib/toaster/toastergui/tables.py           |   8 +-
 .../toastergui/templates/basebuildpage.html        | 148 ++++++++--------
 .../lib/toaster/toastergui/templates/bpackage.html |   2 -
 .../toastergui/templates/builddashboard.html       | 186 ++++++++++---------
 .../toastergui/templates/configuration.html        |   4 +-
 .../toaster/toastergui/templates/configvars.html   |   4 +-
 .../lib/toaster/toastergui/templates/dirinfo.html  | 105 ++++++-----
 .../toaster/toastergui/templates/mrb_section.html  |   7 +-
 .../lib/toaster/toastergui/templates/recipes.html  |   2 -
 .../lib/toaster/toastergui/templates/target.html   |   6 +-
 .../lib/toaster/toastergui/templates/tasks.html    | 196 ++++++++++-----------
 bitbake/lib/toaster/toastergui/views.py            |   1 +
 13 files changed, 354 insertions(+), 330 deletions(-)

--
Elliot Smith
Software Engineer
Intel OTC

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#1 lore raw

PATCH v2 1/2 toaster: adjust build dashboard for failed builds

Remove the side bar and build details modules for failed builds.

Modify templates so that the span is moved out of the individual elements and into the container. This makes it simpler to change the width of the main container, depending on whether the build failed or not (which in turn hides or shows the left-hand menu).

[YOCTO #8443]

---
 bitbake/lib/toaster/orm/models.py                  |  15 ++
 .../toastergui/templates/basebuildpage.html        | 148 ++++++++--------
 .../lib/toaster/toastergui/templates/bpackage.html |   2 -
 .../toastergui/templates/builddashboard.html       | 174 +++++++++---------
 .../toastergui/templates/configuration.html        |   4 +-
 .../toaster/toastergui/templates/configvars.html   |   4 +-
 .../lib/toaster/toastergui/templates/dirinfo.html  | 105 ++++++-----
 .../lib/toaster/toastergui/templates/recipes.html  |   2 -
 .../lib/toaster/toastergui/templates/target.html   |   6 +-
 .../lib/toaster/toastergui/templates/tasks.html    | 196 ++++++++++-----------
 bitbake/lib/toaster/toastergui/views.py            |   1 +
 11 files changed, 332 insertions(+), 325 deletions(-)
bitbake/lib/toaster/orm/models.py +15 -0
index 3c98c0b..1d69c24 100644
@@ -516,6 +516,21 @@ class Build(models.Model):
 
         return target_labels
 
+    def started(self):
+        """
+        As build variables are only added for a build when its BuildStarted event
+        is received, a build with no build variables is counted as
+        "in preparation" and not properly started yet. This method
+        will return False if a build has no build variables (it never properly
+        started), or True otherwise.
+
+        Note that this is a temporary workaround for the fact that we don't
+        have a fine-grained state variable on a build which would allow us
+        to record "in progress" (BuildStarted received) vs. "in preparation".
+        """
+        variables = Variable.objects.filter(build=self)
+        return len(variables) > 0
+
     def get_current_status(self):
         """
         get the status string from the build request if the build
bitbake/lib/toaster/toastergui/templates/basebuildpage.html +70 -78

159 lines not on this page · raw message

bitbake/lib/toaster/toastergui/templates/bpackage.html +0 -2
index 81973cb..88ba2fe 100644
@@ -12,7 +12,6 @@
 {% endblock %}
 
 {% block buildinfomain %}
-<div class="span10">
 
 {% if not request.GET.filter and not request.GET.search and not objects.paginator.count %}
 
@@ -104,5 +103,4 @@
   {% include "basetable_bottom.html" %}
   {% endif %} {# objects.paginator.count #}
 {% endif %} {# Empty #}
-</div>
 {% endblock %}
bitbake/lib/toaster/toastergui/templates/builddashboard.html +91 -83

246 lines not on this page · raw message

bitbake/lib/toaster/toastergui/templates/configuration.html +2 -2
index 85d6a62..2e5c00c 100644
@@ -12,14 +12,14 @@
 
 {% block buildinfomain %}
 <!-- page title -->
-<div class="row-fluid span10">
+<div class="row-fluid">
  <div class="page-header">
      <h1>Configuration</h1>
  </div>
 </div>
 
 <!-- configuration table -->
-<div class="row-fluid pull-right span10" id="navTab">
+<div class="row-fluid" id="navTab">
 <ul class="nav nav-pills">
     <li class="active"><a href="#">Summary</a></li>
     <li class=""><a href="{% url 'configvars' build.id %}">BitBake variables</a></li>
bitbake/lib/toaster/toastergui/templates/configvars.html +2 -2
index e40c225..6348497 100644
@@ -12,7 +12,7 @@
 
 {% block buildinfomain %}
 <!-- page title -->
-<div class="row-fluid span10">
+<div class="row-fluid">
  <div class="page-header">
  <h1>
   {% if request.GET.filter and objects.paginator.count > 0 or request.GET.search and objects.paginator.count > 0 %}
@@ -27,7 +27,7 @@
 </div>
 
 <!-- configuration table -->
-<div class="row-fluid pull-right span10" id="navTab">
+<div class="row-fluid" id="navTab">
   <ul class="nav nav-pills">
     <li class=""><a href="{% url 'configuration' build.id %}">Summary</a></li>
     <li class="active"><a href="#" >BitBake variables</a></li>
bitbake/lib/toaster/toastergui/templates/dirinfo.html +51 -54

119 lines not on this page · raw message

bitbake/lib/toaster/toastergui/templates/recipes.html +0 -2
index d144893..9253d07 100644
@@ -12,7 +12,6 @@
 {% endblock %}
 
 {% block buildinfomain %}
-<div class="span10">
 <div class="page-header">
 <h1>
   {% if request.GET.search and objects.paginator.count > 0  %}
@@ -109,5 +108,4 @@
 
 {% include "basetable_bottom.html" %}
 {% endif %}
-</div>
 {% endblock %}
bitbake/lib/toaster/toastergui/templates/target.html +3 -3
index 4c33eaa..4479eb0 100644
@@ -18,7 +18,7 @@
 
 {% block buildinfomain %}
 
-<div class="row-fluid span10">
+<div class="row-fluid">
     <div class="page-header">
         <h1>
             {% if request.GET.search and objects.paginator.count > 0 %}
@@ -32,7 +32,7 @@
     </div>
 </div>
 
-<div class="row-fluid pull-right span10" id="navTab">
+<div class="row-fluid pull-right" id="navTab">
     <ul class="nav nav-pills">
         <li class="active">
             <a href="#target">
@@ -159,5 +159,5 @@
     {% include "basetable_bottom.html" %}
     {% endif %}
     </div> <!-- tabpane -->
-</div> <!--span 10-->
+</div>
 {% endblock buildinfomain %}
bitbake/lib/toaster/toastergui/templates/tasks.html +97 -99

203 lines not on this page · raw message

bitbake/lib/toaster/toastergui/views.py +1 -0
index 85ca9be..f94fb1c 100755
@@ -506,6 +506,7 @@ def builddashboard( request, build_id ):
 
     context = {
             'build'           : build,
+            'Build'           : Build,
             'hasImages'       : hasImages,
             'ntargets'        : ntargets,
             'targets'         : targets,
Signature · 14 lines
Elliot Smith
Software Engineer
Intel OTC

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#2 lore raw

PATCH v2 2/2 toaster: remove links from time field on failed builds

In reply to Elliot Smith

Failed builds don't have any time data recorded for them, so the time field in the builds table, the time shown in the recent builds area, and the build time shown in the build dashboard should not be links for failed builds.

[YOCTO #8443]

---
 bitbake/lib/toaster/toastergui/tables.py                     |  8 ++++++--
 bitbake/lib/toaster/toastergui/templates/builddashboard.html | 12 ++++++++++--
 bitbake/lib/toaster/toastergui/templates/mrb_section.html    |  7 ++++++-
 3 files changed, 22 insertions(+), 5 deletions(-)
bitbake/lib/toaster/toastergui/tables.py +6 -2
index 67a6592..ebe7431 100644
@@ -1195,9 +1195,13 @@ class BuildsTable(ToasterTable):
 
         time_template = '''
         {% load projecttags %}
-        <a href="{% url "buildtime" data.id %}">
+        {% if data.outcome == extra.Build.SUCCEEDED %}
+            <a href="{% url "buildtime" data.id %}">
+                {{data.timespent_seconds | sectohms}}
+            </a>
+        {% else %}
             {{data.timespent_seconds | sectohms}}
-        </a>
+        {% endif %}
         '''
 
         image_files_template = '''
bitbake/lib/toaster/toastergui/templates/builddashboard.html +10 -2
index b0c3d99..e38ee6c 100644
@@ -41,9 +41,17 @@
 {% endif %}
     <span > <i class="icon-warning-sign yellow"></i><strong><a href="#warnings" class="warning show-warnings"> {{build.warnings.count}} warning{{build.warnings.count|pluralize}}</a></strong></span>
 {% endif %}
-            <span class="pull-right">Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent_seconds|sectohms }}</a>
+            <span class="pull-right">
+              Build time:
+              <span data-build-field="buildtime">
+                {% if build.started %}
+                  <a href="{% url 'buildtime' build.pk %}">{{ build.timespent_seconds|sectohms }}</a>
+                {% else %}
+                  {{ build.timespent_seconds|sectohms }}
+                {% endif %}
+              </span>
             {% if build.cooker_log_path %}
-                <a class="btn {%if build.outcome == build.SUCCEEDED%}btn-success{%else%}btn-danger{%endif%} pull-right log" href="{% url 'build_artifact' build.id "cookerlog" build.id %}">Download build log</a>
+              <a class="btn {%if build.outcome == build.SUCCEEDED%}btn-success{%else%}btn-danger{%endif%} pull-right log" href="{% url 'build_artifact' build.id "cookerlog" build.id %}">Download build log</a>
             {% endif %}
             </span>
 
bitbake/lib/toaster/toastergui/templates/mrb_section.html +6 -1
index 551e341..07914d8 100644
@@ -85,7 +85,12 @@
             </div>
             <div class="lead ">
               <span class="lead">
-                  Build time: <a href="{% url 'buildtime' build.pk %}">{{ build.timespent_seconds|sectohms }}</a>
+                  Build time:
+                  {% if build.outcome == build.SUCCEEDED %}
+                    <a href="{% url 'buildtime' build.pk %}">{{ build.timespent_seconds|sectohms }}</a>
+                  {% else %}
+                    {{ build.timespent_seconds|sectohms }}
+                  {% endif %}
               </span>
               {% if build.project.is_default %}
                   <i class="pull-right icon-question-sign get-help
Signature · 14 lines
Elliot Smith
Software Engineer
Intel OTC

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#3 lore raw
In reply to Elliot Smith
Quoted 4 lines · On 21/03/2016 19:53, "[email protected] on behalf of Elliot…

v2:

Modifications for other templates which were missed in v1, as per Belen's review.

This one looks good: layout issues are fixed.

Thanks!

Belén

Quoted 104 lines

v1:

Builds which fail early at the "build request stage" (i.e. before the BuildStarted
event happens) need a custom build dashboard, as they don't have any buildstats
data, images, recipes etc., so the links in the left-hand menu are irrelevant.

Hide the build dashboard's left-hand menu if a build failed early (before BuildStarted). Also remove the build time links for the failed builds, as time data is not available.

The state of the build as "started" or not is determined by looking for build variables associated with a build. As these variables are only added at the point when BuildStarted occurs, any Build object without these variables hasn't triggered a BuildStarted event.

(This is something of a work-around; in future we may have more fine-grained
states on a build so that we can properly tell its state. When this happens, the
Build.started() method could be modified to properly reflect this.)

To test:

1. Start a build with a bad target, e.g. "zzz".
2. When the build fails, go to the dashboard for the build. The left-hand menu
should not be visible.
3. Go to the all builds page. The build time for the failed build should not have a hyperlink on it.
4. Start a build with a bad MACHINE variable setting (either modify in project
configuration or in conf/toaster.conf).
5. Repeat steps 2 and 3 for the failed build.
6. Start a build with a bad DISTRO variable setting (either modify in project
configuration or in conf/toaster.conf).
7. Repeat steps 2 and 3 for the failed build.
8. Start a good build, e.g. "mpfr-native".
9. When the build completes (successfully), go to the dashboard. The left-hand
menu should be visible and functioning.
10. Go to the all builds page. Links on the build time should be present and
should point at the time page for the build.

Note that I have some Selenium tests for testing these changes, but they depend on a previous patchset which is not yet in toaster-next; see
https://lists.yoctoproject.org/pipermail/toaster/2016-March/004164.html.

Changes since 358ba11b15f5182c4d667cf35565afc0c6ad4126 (toaster-next) are in
git://git.yoctoproject.org/poky-contrib,
elliot/toaster/failed_builds_display-8443
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=elliot/toaster/fa
iled_builds_display-8443

Related bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8443

Elliot Smith (2):
toaster: adjust build dashboard for failed builds
toaster: remove links from time field on failed builds

bitbake/lib/toaster/orm/models.py                  |  15 ++
bitbake/lib/toaster/toastergui/tables.py           |   8 +-
.../toastergui/templates/basebuildpage.html        | 148 ++++++++--------
.../lib/toaster/toastergui/templates/bpackage.html |   2 -
.../toastergui/templates/builddashboard.html       | 186
++++++++++---------
.../toastergui/templates/configuration.html        |   4 +-
.../toaster/toastergui/templates/configvars.html   |   4 +-
.../lib/toaster/toastergui/templates/dirinfo.html  | 105 ++++++-----
.../toaster/toastergui/templates/mrb_section.html  |   7 +-
.../lib/toaster/toastergui/templates/recipes.html  |   2 -
.../lib/toaster/toastergui/templates/target.html   |   6 +-
.../lib/toaster/toastergui/templates/tasks.html    | 196
++++++++++-----------
bitbake/lib/toaster/toastergui/views.py            |   1 +
13 files changed, 354 insertions(+), 330 deletions(-)

--
Elliot Smith
Software Engineer
Intel OTC

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

Signature · 4 lines
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster