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



Title: GitLab

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

Commits:

1 changed file:

Changes:

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



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