diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-08-29 15:55:54 -0400 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-08-29 15:58:25 -0400 |
commit | ccddb1e827d9f2fe38974d3d331682312679893e (patch) | |
tree | 7d77a74d6ac2f9913f9d93371964b0cef64294f7 | |
parent | b27e606383339ea46a55e5cf796143c7e95b0b3a (diff) | |
download | buildstream-ccddb1e827d9f2fe38974d3d331682312679893e.tar.gz |
plugin.py: Added detail parameter to Plugin.timed_activity()
Allows for more information in timed activities, consequently
avoiding the need for additional status messages in some cases.
The message detail component is only shown at activity START time
but omitted at FAILURE/SUCCESS time.
-rw-r--r-- | buildstream/plugin.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/buildstream/plugin.py b/buildstream/plugin.py index 5f0d7bf07..83e4d48ea 100644 --- a/buildstream/plugin.py +++ b/buildstream/plugin.py @@ -318,11 +318,12 @@ class Plugin(): self.__message(MessageType.ERROR, brief, detail=detail) @contextmanager - def timed_activity(self, activity_name, silent_nested=False): + def timed_activity(self, activity_name, detail=None, silent_nested=False): """Context manager for performing timed activities in plugins Args: activity_name (str): The name of the activity + detail (str): An optional detailed message, can be multiline output silent_nested (bool): If specified, nested messages will be silenced This function lets you perform timed tasks in your plugin, @@ -355,7 +356,7 @@ class Plugin(): with _signals.suspendable(stop_time, resume_time): try: # Push activity depth for status messages - self.__message(MessageType.START, activity_name) + self.__message(MessageType.START, activity_name, detail=detail) self.__context._push_message_depth(silent_nested) yield |