summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-17 08:52:07 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-17 08:52:07 +0000
commitc102b92fe4a3f1c71a77629a57a9838b83ee19b8 (patch)
tree71e2a359e3c5616e8cac555aff6931e66868fe09
parent1e3e2a936d706509d4f75fa7181c9081ad6cfa40 (diff)
parent10f27f3f84dcbf03328193f5ae573f41bc74da01 (diff)
downloadbuildstream-c102b92fe4a3f1c71a77629a57a9838b83ee19b8.tar.gz
Merge branch 'tristan/notifications' into 'master'
_frontend/app.py: Notify session completions Closes #385 See merge request BuildStream/buildstream!672
-rw-r--r--buildstream/_frontend/app.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/buildstream/_frontend/app.py b/buildstream/_frontend/app.py
index 5c13bf0bf..1550fbcb3 100644
--- a/buildstream/_frontend/app.py
+++ b/buildstream/_frontend/app.py
@@ -269,6 +269,9 @@ class App():
else:
self._message(MessageType.FAIL, session_name, elapsed=elapsed)
+ # Notify session failure
+ self._notify("{} failed".format(session_name), "{}".format(e))
+
if self._started:
self._print_summary()
@@ -286,6 +289,9 @@ class App():
if self._started:
self._print_summary()
+ # Notify session success
+ self._notify("{} succeeded".format(session_name), "")
+
# init_project()
#
# Initialize a new BuildStream project, either with the explicitly passed options,
@@ -419,6 +425,12 @@ class App():
# Local Functions #
############################################################
+ # Local function for calling the notify() virtual method
+ #
+ def _notify(self, title, text):
+ if self.interactive:
+ self.notify(title, text)
+
# Local message propagator
#
def _message(self, message_type, message, **kwargs):
@@ -571,8 +583,8 @@ class App():
while choice not in ['continue', 'quit', 'terminate', 'retry']:
click.echo(summary, err=True)
- self.notify("BuildStream failure", "{} on element {}"
- .format(failure.action_name, element.name))
+ self._notify("BuildStream failure", "{} on element {}"
+ .format(failure.action_name, element.name))
try:
choice = click.prompt("Choice:", default='continue', err=True,