[Notes] [Git][BuildStream/buildstream][tiagogomes/issue-577-backport] 3 commits: _frontend/app.py: Notify session completions



Title: GitLab

Javier Jardón pushed to branch tiagogomes/issue-577-backport at BuildStream / buildstream

Commits:

2 changed files:

Changes:

  • buildstream/_artifactcache/cascache.py
    ... ... @@ -24,6 +24,7 @@ import os
    24 24
     import signal
    
    25 25
     import stat
    
    26 26
     import tempfile
    
    27
    +import errno
    
    27 28
     from urllib.parse import urlparse
    
    28 29
     
    
    29 30
     import grpc
    
    ... ... @@ -81,7 +82,8 @@ class CASCache(ArtifactCache):
    81 82
     
    
    82 83
             tree = self.resolve_ref(ref, update_mtime=True)
    
    83 84
     
    
    84
    -        dest = os.path.join(self.extractdir, element._get_project().name, element.normal_name, tree.hash)
    
    85
    +        dest = os.path.join(self.extractdir, element._get_project().name,
    
    86
    +                            element.normal_name, tree.hash)
    
    85 87
             if os.path.isdir(dest):
    
    86 88
                 # artifact has already been extracted
    
    87 89
                 return dest
    
    ... ... @@ -99,7 +101,7 @@ class CASCache(ArtifactCache):
    99 101
                     #
    
    100 102
                     # If rename fails with these errors, another process beat
    
    101 103
                     # us to it so just ignore.
    
    102
    -                if e.errno not in [os.errno.ENOTEMPTY, os.errno.EEXIST]:
    
    104
    +                if e.errno not in [errno.ENOTEMPTY, errno.EEXIST]:
    
    103 105
                         raise ArtifactError("Failed to extract artifact for ref '{}': {}"
    
    104 106
                                             .format(ref, e)) from e
    
    105 107
     
    

  • 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]