[Notes] [Git][BuildStream/buildstream][mablanch/447-stack-trace-checkout] 5 commits: message.py: MessagesType.SKIPPED added



Title: GitLab

Martin Blanchard pushed to branch mablanch/447-stack-trace-checkout at BuildStream / buildstream

Commits:

6 changed files:

Changes:

  • buildstream/_artifactcache/cascache.py
    ... ... @@ -32,6 +32,7 @@ from .._protos.google.bytestream import bytestream_pb2, bytestream_pb2_grpc
    32 32
     from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
    
    33 33
     from .._protos.buildstream.v2 import buildstream_pb2, buildstream_pb2_grpc
    
    34 34
     
    
    35
    +from .._message import MessageType, Message
    
    35 36
     from .. import _signals, utils
    
    36 37
     from .._exceptions import ArtifactError
    
    37 38
     
    
    ... ... @@ -264,7 +265,7 @@ class CASCache(ArtifactCache):
    264 265
     
    
    265 266
             for remote in push_remotes:
    
    266 267
                 remote.init()
    
    267
    -
    
    268
    +            skipped_remote = True
    
    268 269
                 element.info("Pushing {} -> {}".format(element._get_brief_display_key(), remote.spec.url))
    
    269 270
     
    
    270 271
                 try:
    
    ... ... @@ -280,8 +281,6 @@ class CASCache(ArtifactCache):
    280 281
     
    
    281 282
                             if response.digest.hash == tree.hash and response.digest.size_bytes == tree.size_bytes:
    
    282 283
                                 # ref is already on the server with the same tree
    
    283
    -                            element.info("Skipping {}, remote ({}) already has artifact cached".format(
    
    284
    -                                element._get_brief_display_key(), remote.spec.url))
    
    285 284
                                 continue
    
    286 285
     
    
    287 286
                         except grpc.RpcError as e:
    
    ... ... @@ -309,6 +308,7 @@ class CASCache(ArtifactCache):
    309 308
                                 missing_blobs[d.hash] = d
    
    310 309
     
    
    311 310
                         # Upload any blobs missing on the server
    
    311
    +                    skipped_remote = False
    
    312 312
                         for digest in missing_blobs.values():
    
    313 313
                             def request_stream():
    
    314 314
                                 resource_name = os.path.join(digest.hash, str(digest.size_bytes))
    
    ... ... @@ -344,6 +344,13 @@ class CASCache(ArtifactCache):
    344 344
                     if e.code() != grpc.StatusCode.RESOURCE_EXHAUSTED:
    
    345 345
                         raise ArtifactError("Failed to push artifact {}: {}".format(refs, e), temporary=True) from e
    
    346 346
     
    
    347
    +            if skipped_remote:
    
    348
    +                self.context.message(Message(
    
    349
    +                    None,
    
    350
    +                    MessageType.SKIPPED,
    
    351
    +                    "Remote ({}) already has {} cached".format(
    
    352
    +                        remote.spec.url, element._get_brief_display_key())
    
    353
    +                ))
    
    347 354
             return pushed
    
    348 355
     
    
    349 356
         ################################################
    

  • buildstream/_frontend/widget.py
    ... ... @@ -160,6 +160,7 @@ class TypeName(Widget):
    160 160
             MessageType.START: "blue",
    
    161 161
             MessageType.SUCCESS: "green",
    
    162 162
             MessageType.FAIL: "red",
    
    163
    +        MessageType.SKIPPED: "yellow",
    
    163 164
             MessageType.ERROR: "red",
    
    164 165
             MessageType.BUG: "red",
    
    165 166
         }
    

  • buildstream/_message.py
    ... ... @@ -36,6 +36,7 @@ class MessageType():
    36 36
         START = "start"        # Status start message
    
    37 37
         SUCCESS = "success"    # Successful status complete message
    
    38 38
         FAIL = "failure"       # Failing status complete message
    
    39
    +    SKIPPED = "skipped"
    
    39 40
     
    
    40 41
     
    
    41 42
     # Messages which should be reported regardless of whether
    

  • buildstream/_stream.py
    ... ... @@ -434,7 +434,7 @@ class Stream():
    434 434
     
    
    435 435
             except BstError as e:
    
    436 436
                 raise StreamError("Error while staging dependencies into a sandbox"
    
    437
    -                              ": '{}'".format(e), reason=e.reason) from e
    
    437
    +                              ": '{}'".format(e), detail=e.detail, reason=e.reason) from e
    
    438 438
     
    
    439 439
         # workspace_open
    
    440 440
         #
    

  • buildstream/element.py
    ... ... @@ -623,6 +623,12 @@ class Element(Plugin):
    623 623
                   dep.stage_artifact(sandbox)
    
    624 624
             """
    
    625 625
     
    
    626
    +        if not self._cached():
    
    627
    +            detail = "No artifacts have been cached yet for that element\n" + \
    
    628
    +                     "Try building the element first with `bst build`\n"
    
    629
    +            raise ElementError("No artifacts to stage",
    
    630
    +                               detail=detail, reason="uncached-checkout-attempt")
    
    631
    +
    
    626 632
             if update_mtimes is None:
    
    627 633
                 update_mtimes = []
    
    628 634
     
    

  • tests/frontend/buildcheckout.py
    ... ... @@ -96,6 +96,16 @@ def test_build_checkout_deps(datafiles, cli, deps):
    96 96
             assert not os.path.exists(filename)
    
    97 97
     
    
    98 98
     
    
    99
    +@pytest.mark.datafiles(DATA_DIR)
    
    100
    +def test_build_checkout_unbuilt(datafiles, cli):
    
    101
    +    project = os.path.join(datafiles.dirname, datafiles.basename)
    
    102
    +    checkout = os.path.join(cli.directory, 'checkout')
    
    103
    +
    
    104
    +    # Check that checking out an unbuilt element fails nicely
    
    105
    +    result = cli.run(project=project, args=['checkout', 'target.bst', checkout])
    
    106
    +    result.assert_main_error(ErrorDomain.STREAM, "uncached-checkout-attempt")
    
    107
    +
    
    108
    +
    
    99 109
     @pytest.mark.datafiles(DATA_DIR)
    
    100 110
     def test_build_checkout_tarball(datafiles, cli):
    
    101 111
         project = os.path.join(datafiles.dirname, datafiles.basename)
    



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