You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2022/08/18 07:00:47 UTC

[buildstream] branch tristan/artifact-cache-refactor created (now 204bd8254)

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a change to branch tristan/artifact-cache-refactor
in repository https://gitbox.apache.org/repos/asf/buildstream.git


      at 204bd8254 _artifactcache.py: Remove unused functions pull_tree() and push_message()

This branch includes the following new commits:

     new 992d610cb tests: Refactor pull.py / push.py tests to not use deprecated methods
     new 204bd8254 _artifactcache.py: Remove unused functions pull_tree() and push_message()

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 02/02: _artifactcache.py: Remove unused functions pull_tree() and push_message()

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/artifact-cache-refactor
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 204bd82541d2e78a8e31faaead9abe1638a8e43a
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Thu Aug 18 15:59:45 2022 +0900

    _artifactcache.py: Remove unused functions pull_tree() and push_message()
    
    Fixes #781
---
 src/buildstream/_artifactcache.py | 43 ---------------------------------------
 1 file changed, 43 deletions(-)

diff --git a/src/buildstream/_artifactcache.py b/src/buildstream/_artifactcache.py
index 9c4b00341..b8559428b 100644
--- a/src/buildstream/_artifactcache.py
+++ b/src/buildstream/_artifactcache.py
@@ -222,49 +222,6 @@ class ArtifactCache(AssetCache):
 
         return False
 
-    # pull_tree():
-    #
-    # Pull a single Tree rather than an artifact.
-    # Does not update local refs.
-    #
-    # Args:
-    #     project (Project): The current project
-    #     digest (Digest): The digest of the tree
-    #
-    def pull_tree(self, project, digest):
-        _, storage_remotes = self.get_remotes(project.name, False)
-        for remote in storage_remotes:
-            digest = self.cas.pull_tree(remote, digest)
-
-            if digest:
-                # no need to pull from additional remotes
-                return digest
-
-        return None
-
-    # push_message():
-    #
-    # Push the given protobuf message to all remotes.
-    #
-    # Args:
-    #     project (Project): The current project
-    #     message (Message): A protobuf message to push.
-    #
-    # Raises:
-    #     (ArtifactError): if there was an error
-    #
-    def push_message(self, project, message):
-        _, push_remotes = self.get_remotes(project.name, True)
-        if not push_remotes:
-            raise ArtifactError(
-                "push_message was called, but no remote artifact " + "servers are configured as push remotes."
-            )
-
-        for remote in push_remotes:
-            message_digest = remote.push_message(message)
-
-        return message_digest
-
     # link_key():
     #
     # Add a key for an existing artifact.


[buildstream] 01/02: tests: Refactor pull.py / push.py tests to not use deprecated methods

Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/artifact-cache-refactor
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 992d610cb275318409d95a7c7485c4d3ab140d81
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Thu Aug 18 15:57:55 2022 +0900

    tests: Refactor pull.py / push.py tests to not use deprecated methods
    
    As per issue #781, these functions are meant to be removed.
---
 tests/artifactcache/pull.py | 8 ++++++--
 tests/artifactcache/push.py | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/artifactcache/pull.py b/tests/artifactcache/pull.py
index e54ba5124..5c3c06665 100644
--- a/tests/artifactcache/pull.py
+++ b/tests/artifactcache/pull.py
@@ -171,7 +171,9 @@ def test_pull_tree(cli, tmpdir, datafiles):
             tree_maker(cas, tree, directory)
 
             # Push the Tree as a regular message
-            tree_digest = artifactcache.push_message(project, tree)
+            _, remotes = artifactcache.get_remotes(project.name, True)
+            assert len(remotes) == 1
+            tree_digest = remotes[0].push_message(tree)
             tree_hash, tree_size = tree_digest.hash, tree_digest.size_bytes
             assert tree_hash and tree_size
 
@@ -187,7 +189,9 @@ def test_pull_tree(cli, tmpdir, datafiles):
             tree_digest = remote_execution_pb2.Digest(hash=tree_hash, size_bytes=tree_size)
 
             # Pull the artifact using the Tree object
-            directory_digest = artifactcache.pull_tree(project, artifact_digest)
+            _, remotes = artifactcache.get_remotes(project.name, False)
+            assert len(remotes) == 1
+            directory_digest = cas.pull_tree(remotes[0], tree_digest)
             directory_hash, directory_size = directory_digest.hash, directory_digest.size_bytes
 
         # Directory size now zero with AaaP and stack element commit #1cbc5e63dc
diff --git a/tests/artifactcache/push.py b/tests/artifactcache/push.py
index 8af03838e..4748b5831 100644
--- a/tests/artifactcache/push.py
+++ b/tests/artifactcache/push.py
@@ -164,7 +164,9 @@ def test_push_message(tmpdir, datafiles):
             )
 
             # Push the message object
-            command_digest = artifactcache.push_message(project, command)
+            _, remotes = artifactcache.get_remotes(project.name, True)
+            assert len(remotes) == 1
+            command_digest = remotes[0].push_message(command)
             message_hash, message_size = command_digest.hash, command_digest.size_bytes
 
         assert message_hash and message_size