summaryrefslogtreecommitdiff
path: root/src/buildstream/plugin.py
diff options
context:
space:
mode:
authorTom Pollard <tom.pollard@codethink.co.uk>2019-07-31 16:31:47 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-08-08 13:52:36 +0000
commit0026e37918998addb61d7cefcbb9b5f7f6f7b4f4 (patch)
treea756eaf5ba545882f8ec69204759ac22b8112d23 /src/buildstream/plugin.py
parent1701aa1239f472317edfc6f675378dc91b1fcd61 (diff)
downloadbuildstream-tpollard/messageobject.tar.gz
_message.py: Use element_name & element_key instead of unique_idtpollard/messageobject
Adding the element full name and display key into all element related messages removes the need to look up the plugintable via a plugin unique_id just to retrieve the same values for logging and widget frontend display. Relying on plugintable state is also incompatible if the frontend will be running in a different process, as it will exist in multiple states. The element full name is now displayed instead of the unique_id, such as in the debugging widget. It is also displayed in place of 'name' (i.e including any junction prepend) to be more informative.
Diffstat (limited to 'src/buildstream/plugin.py')
-rw-r--r--src/buildstream/plugin.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/buildstream/plugin.py b/src/buildstream/plugin.py
index 3cce0fbf1..5783eb270 100644
--- a/src/buildstream/plugin.py
+++ b/src/buildstream/plugin.py
@@ -428,6 +428,9 @@ class Plugin():
Note: Informative messages tell the user something they might want
to know, like if refreshing an element caused it to change.
+ The instance full name of the plugin will be generated with the
+ message, this being the name of the given element, as appose to
+ the class name of the underlying plugin __kind identifier.
"""
self.__message(MessageType.INFO, brief, detail=detail)
@@ -491,7 +494,7 @@ class Plugin():
self.call(... command which takes time ...)
"""
with self.__context.messenger.timed_activity(activity_name,
- unique_id=self._unique_id,
+ element_name=self._get_full_name(),
detail=detail,
silent_nested=silent_nested):
yield
@@ -733,7 +736,7 @@ class Plugin():
return (exit_code, output)
def __message(self, message_type, brief, **kwargs):
- message = Message(self._unique_id, message_type, brief, **kwargs)
+ message = Message(message_type, brief, element_name=self._get_full_name(), **kwargs)
self.__context.messenger.message(message)
def __note_command(self, output, *popenargs, **kwargs):
@@ -761,10 +764,12 @@ class Plugin():
def __get_full_name(self):
project = self.__project
+ # Set the name, depending on element or source plugin type
+ name = self._element_name if self.__type_tag == "source" else self.name # pylint: disable=no-member
if project.junction:
- return '{}:{}'.format(project.junction.name, self.name)
+ return '{}:{}'.format(project.junction.name, name)
else:
- return self.name
+ return name
# A local table for _prefix_warning()