summaryrefslogtreecommitdiff
path: root/src/buildstream/source.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/source.py
parent1701aa1239f472317edfc6f675378dc91b1fcd61 (diff)
downloadbuildstream-0026e37918998addb61d7cefcbb9b5f7f6f7b4f4.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/source.py')
-rw-r--r--src/buildstream/source.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/buildstream/source.py b/src/buildstream/source.py
index b513fdb2a..c5fb61415 100644
--- a/src/buildstream/source.py
+++ b/src/buildstream/source.py
@@ -308,10 +308,11 @@ class Source(Plugin):
def __init__(self, context, project, meta, *, alias_override=None, unique_id=None):
provenance = meta.config.get_provenance()
+ # Set element_name member before parent init, as needed for debug messaging
+ self.__element_name = meta.element_name # The name of the element owning this source
super().__init__("{}-{}".format(meta.element_name, meta.element_index),
context, project, provenance, "source", unique_id=unique_id)
- self.__element_name = meta.element_name # The name of the element owning this source
self.__element_index = meta.element_index # The index of the source in the owning element's source list
self.__element_kind = meta.element_kind # The kind of the element owning this source
self.__directory = meta.directory # Staging relative directory
@@ -1076,6 +1077,10 @@ class Source(Plugin):
length = min(len(key), context.log_key_length)
return key[:length]
+ @property
+ def _element_name(self):
+ return self.__element_name
+
# _get_args_for_child_job_pickling(self)
#
# Return data necessary to reconstruct this object in a child job process.