You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/08/22 06:47:11 UTC

[buildstream] branch tristan/only-print-last-failure created (now 371dbad3a)

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a change to branch tristan/only-print-last-failure
in repository https://gitbox.apache.org/repos/asf/buildstream.git


      at 371dbad3a _frontend/widget.py: Only save the last failure message for any given element.

This branch includes the following new commits:

     new 4b97ab697 _frontend/widget.py: Remove use of OrderedDict()
     new 371dbad3a _frontend/widget.py: Only save the last failure message for any given element.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 02/02: _frontend/widget.py: Only save the last failure message for any given element.

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/only-print-last-failure
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 371dbad3a5736047742368bf5b99a32b3337c0f6
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Mon Aug 22 15:44:27 2022 +0900

    _frontend/widget.py: Only save the last failure message for any given element.
    
    If the element ultimately failed, it's last failure message will be printed
    in the failure summary. If it previously was retried and succeeded, it will
    not be printed because it will not show up in the failed tasks from
    State.task_groups at session end time.
    
    Fixes #517.
---
 src/buildstream/_frontend/widget.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/buildstream/_frontend/widget.py b/src/buildstream/_frontend/widget.py
index 653bcd14c..e815933cd 100644
--- a/src/buildstream/_frontend/widget.py
+++ b/src/buildstream/_frontend/widget.py
@@ -17,7 +17,6 @@
 #        Tristan Van Berkom <tr...@codethink.co.uk>
 import datetime
 import os
-from collections import defaultdict
 from contextlib import ExitStack
 from mmap import mmap
 import re
@@ -298,7 +297,7 @@ class LogLine(Widget):
         super().__init__(context, content_profile, format_profile)
 
         self._columns = []
-        self._failure_messages = defaultdict(list)
+        self._failure_messages = {}
         self._success_profile = success_profile
         self._err_profile = err_profile
         self._detail_profile = detail_profile
@@ -612,12 +611,12 @@ class LogLine(Widget):
         if self._failure_messages:
             values = {}
 
-            for element_name, messages in sorted(self._failure_messages.items()):
+            for element_name, message in sorted(self._failure_messages.items()):
                 for group in self._state.task_groups.values():
                     # Exclude the failure messages if the job didn't ultimately fail
                     # (e.g. succeeded on retry)
                     if element_name in group.failed_tasks:
-                        values[element_name] = "".join(self._render(v) for v in messages)
+                        values[element_name] = self._render(message)
 
             if values:
                 text += self.content_profile.fmt("Failure Summary\n", bold=True)
@@ -678,7 +677,7 @@ class LogLine(Widget):
         # Track logfiles for later use
         element_name = message.element_name
         if message.message_type in ERROR_MESSAGES and element_name is not None:
-            self._failure_messages[element_name].append(message)
+            self._failure_messages[element_name] = message
 
         return self._render(message)
 


[buildstream] 01/02: _frontend/widget.py: Remove use of OrderedDict()

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/only-print-last-failure
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 4b97ab697a4af0eda650a9704269fa75c502911d
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Mon Aug 22 15:41:40 2022 +0900

    _frontend/widget.py: Remove use of OrderedDict()
    
    Since a long time in Python 3, dict already has the ordered behavior
    of OrderedDict(). No need to use OrderedDict() here.
---
 src/buildstream/_frontend/widget.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/buildstream/_frontend/widget.py b/src/buildstream/_frontend/widget.py
index 1af710a79..653bcd14c 100644
--- a/src/buildstream/_frontend/widget.py
+++ b/src/buildstream/_frontend/widget.py
@@ -17,7 +17,7 @@
 #        Tristan Van Berkom <tr...@codethink.co.uk>
 import datetime
 import os
-from collections import defaultdict, OrderedDict
+from collections import defaultdict
 from contextlib import ExitStack
 from mmap import mmap
 import re
@@ -462,7 +462,7 @@ class LogLine(Widget):
         # Main invocation context
         text += "\n"
         text += self.content_profile.fmt("BuildStream Version {}\n".format(bst_version), bold=True)
-        values = OrderedDict()
+        values = {}
         values["Session Start"] = starttime.strftime("%A, %d-%m-%Y at %H:%M:%S")
         if toplevel_project:
             values["Project"] = "{} ({})".format(toplevel_project.name, toplevel_project.directory)
@@ -472,7 +472,7 @@ class LogLine(Widget):
         # User configurations
         text += "\n"
         text += self.content_profile.fmt("User Configuration\n", bold=True)
-        values = OrderedDict()
+        values = {}
         values["Configuration File"] = "Default Configuration" if not context.config_origin else context.config_origin
         values["Cache Directory"] = context.cachedir
         values["Log Files"] = context.logdir
@@ -494,7 +494,7 @@ class LogLine(Widget):
 
             text += "\n"
             text += self.content_profile.fmt("Remote Execution Configuration\n", bold=True)
-            values = OrderedDict()
+            values = {}
             values["Execution Service"] = format_spec(specs.exec_spec)
             re_storage_spec = specs.storage_spec or context.remote_cache_spec
             values["Storage Service"] = format_spec(re_storage_spec)
@@ -523,7 +523,7 @@ class LogLine(Widget):
 
             # Details on how the project was loaded
             #
-            values = OrderedDict()
+            values = {}
             if project.junction:
                 values["Junction path"] = project_info.project.junction._get_full_name()
             if project_info.provenance:
@@ -545,7 +545,7 @@ class LogLine(Widget):
             text += "\n"
 
             # Project Options
-            values = OrderedDict()
+            values = {}
             project.options.printable_variables(values)
             if values:
                 text += self.format_profile.fmt("{}Project Options\n".format(self._indent))
@@ -610,7 +610,7 @@ class LogLine(Widget):
             text += "\n\n"
 
         if self._failure_messages:
-            values = OrderedDict()
+            values = {}
 
             for element_name, messages in sorted(self._failure_messages.items()):
                 for group in self._state.task_groups.values():
@@ -624,7 +624,7 @@ class LogLine(Widget):
                 text += self._format_values(values, style_value=False)
 
         text += self.content_profile.fmt("Pipeline Summary\n", bold=True)
-        values = OrderedDict()
+        values = {}
 
         values["Total"] = self.content_profile.fmt(str(len(stream.total_elements)))
         values["Session"] = self.content_profile.fmt(str(len(stream.session_elements)))
@@ -838,7 +838,7 @@ class LogLine(Widget):
     # the values are aligned.
     #
     # Args:
-    #    values (dict): A dictionary, usually an OrderedDict()
+    #    values (dict): A dictionary
     #    style_key (bool): Whether to use the content profile for the keys
     #    style_value (bool): Whether to use the content profile for the values
     #    indent (number): Number of initial indentation levels