[Notes] [Git][BuildStream/buildstream][tristan/notifications] _frontend/app.py: Notify session completions



Title: GitLab

Tristan Van Berkom pushed to branch tristan/notifications at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • buildstream/_frontend/app.py
    ... ... @@ -269,6 +269,9 @@ class App():
    269 269
                     else:
    
    270 270
                         self._message(MessageType.FAIL, session_name, elapsed=elapsed)
    
    271 271
     
    
    272
    +                    # Notify session failure
    
    273
    +                    self._notify("{} failed".format(session_name), "{}".format(e))
    
    274
    +
    
    272 275
                     if self._started:
    
    273 276
                         self._print_summary()
    
    274 277
     
    
    ... ... @@ -286,6 +289,9 @@ class App():
    286 289
                     if self._started:
    
    287 290
                         self._print_summary()
    
    288 291
     
    
    292
    +                # Notify session success
    
    293
    +                self._notify("{} succeeded".format(session_name), "")
    
    294
    +
    
    289 295
         # init_project()
    
    290 296
         #
    
    291 297
         # Initialize a new BuildStream project, either with the explicitly passed options,
    
    ... ... @@ -419,6 +425,12 @@ class App():
    419 425
         #                      Local Functions                     #
    
    420 426
         ############################################################
    
    421 427
     
    
    428
    +    # Local function for calling the notify() virtual method
    
    429
    +    #
    
    430
    +    def _notify(self, title, text):
    
    431
    +        if self.interactive:
    
    432
    +            self.notify(title, text)
    
    433
    +
    
    422 434
         # Local message propagator
    
    423 435
         #
    
    424 436
         def _message(self, message_type, message, **kwargs):
    
    ... ... @@ -571,8 +583,8 @@ class App():
    571 583
                 while choice not in ['continue', 'quit', 'terminate', 'retry']:
    
    572 584
                     click.echo(summary, err=True)
    
    573 585
     
    
    574
    -                self.notify("BuildStream failure", "{} on element {}"
    
    575
    -                            .format(failure.action_name, element.name))
    
    586
    +                self._notify("BuildStream failure", "{} on element {}"
    
    587
    +                             .format(failure.action_name, element.name))
    
    576 588
     
    
    577 589
                     try:
    
    578 590
                         choice = click.prompt("Choice:", default='continue', err=True,
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]