summaryrefslogtreecommitdiff
path: root/src/buildstream/_message.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/_message.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/_message.py')
-rw-r--r--src/buildstream/_message.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/buildstream/_message.py b/src/buildstream/_message.py
index 7f1a939d2..195eba679 100644
--- a/src/buildstream/_message.py
+++ b/src/buildstream/_message.py
@@ -54,8 +54,9 @@ unconditional_messages = [
#
class Message():
- def __init__(self, unique_id, message_type, message,
- task_id=None,
+ def __init__(self, message_type, message, *,
+ element_name=None,
+ element_key=None,
detail=None,
action_name=None,
elapsed=None,
@@ -64,14 +65,14 @@ class Message():
scheduler=False):
self.message_type = message_type # Message type
self.message = message # The message string
+ self.element_name = element_name # The instance element name of the issuing plugin
+ self.element_key = element_key # The display key of the issuing plugin element
self.detail = detail # An additional detail string
self.action_name = action_name # Name of the task queue (fetch, refresh, build, etc)
self.elapsed = elapsed # The elapsed time, in timed messages
self.logfile = logfile # The log file path where commands took place
self.sandbox = sandbox # The error that caused this message used a sandbox
self.pid = os.getpid() # The process pid
- self.unique_id = unique_id # The plugin object ID issueing the message
- self.task_id = task_id # The plugin object ID of the task
self.scheduler = scheduler # Whether this is a scheduler level message
self.creation_time = datetime.datetime.now()
if message_type in (MessageType.SUCCESS, MessageType.FAIL):