[Notes] [Git][BuildStream/buildstream][danielsilverstone-ct/fix-654] sandbox/_sandboxremote.py: Acquire artifact cache via Platform



Title: GitLab

Daniel pushed to branch danielsilverstone-ct/fix-654 at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • buildstream/sandbox/_sandboxremote.py
    ... ... @@ -27,7 +27,7 @@ from . import Sandbox
    27 27
     from ..storage._filebaseddirectory import FileBasedDirectory
    
    28 28
     from ..storage._casbaseddirectory import CasBasedDirectory
    
    29 29
     from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
    
    30
    -from .._artifactcache.cascache import CASCache
    
    30
    +from .._platform import Platform
    
    31 31
     
    
    32 32
     
    
    33 33
     class SandboxError(Exception):
    
    ... ... @@ -43,7 +43,6 @@ class SandboxRemote(Sandbox):
    43 43
     
    
    44 44
         def __init__(self, *args, **kwargs):
    
    45 45
             super().__init__(*args, **kwargs)
    
    46
    -        self.cascache = None
    
    47 46
     
    
    48 47
             url = urlparse(kwargs['server_url'])
    
    49 48
             if not url.scheme or not url.hostname or not url.port:
    
    ... ... @@ -56,12 +55,6 @@ class SandboxRemote(Sandbox):
    56 55
     
    
    57 56
             self.server_url = '{}:{}'.format(url.hostname, url.port)
    
    58 57
     
    
    59
    -    def _get_cascache(self):
    
    60
    -        if self.cascache is None:
    
    61
    -            self.cascache = CASCache(self._get_context())
    
    62
    -            self.cascache.setup_remotes(use_config=True)
    
    63
    -        return self.cascache
    
    64
    -
    
    65 58
         def run_remote_command(self, command, input_root_digest, working_directory, environment):
    
    66 59
             # Sends an execution request to the remote execution server.
    
    67 60
             #
    
    ... ... @@ -78,8 +71,8 @@ class SandboxRemote(Sandbox):
    78 71
                                                           output_files=[],
    
    79 72
                                                           output_directories=[self._output_directory],
    
    80 73
                                                           platform=None)
    
    81
    -
    
    82
    -        cascache = self._get_cascache()
    
    74
    +        platform = Platform.get_platform()
    
    75
    +        cascache = platform.artifactcache
    
    83 76
             # Upload the Command message to the remote CAS server
    
    84 77
             command_digest = cascache.push_message(self._get_project(), remote_command)
    
    85 78
             if not command_digest or not cascache.verify_digest_pushed(self._get_project(), command_digest):
    
    ... ... @@ -141,7 +134,8 @@ class SandboxRemote(Sandbox):
    141 134
             if tree_digest is None or not tree_digest.hash:
    
    142 135
                 raise SandboxError("Output directory structure had no digest attached.")
    
    143 136
     
    
    144
    -        cascache = self._get_cascache()
    
    137
    +        platform = Platform.get_platform()
    
    138
    +        cascache = platform.artifactcache
    
    145 139
             # Now do a pull to ensure we have the necessary parts.
    
    146 140
             dir_digest = cascache.pull_tree(self._get_project(), tree_digest)
    
    147 141
             if dir_digest is None or not dir_digest.hash or not dir_digest.size_bytes:
    
    ... ... @@ -176,7 +170,8 @@ class SandboxRemote(Sandbox):
    176 170
     
    
    177 171
             upload_vdir.recalculate_hash()
    
    178 172
     
    
    179
    -        cascache = self._get_cascache()
    
    173
    +        platform = Platform.get_platform()
    
    174
    +        cascache = platform.artifactcache
    
    180 175
             # Now, push that key (without necessarily needing a ref) to the remote.
    
    181 176
             vdir_digest = cascache.push_directory(self._get_project(), upload_vdir)
    
    182 177
             if not vdir_digest or not cascache.verify_digest_pushed(self._get_project(), vdir_digest):
    



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