[Notes] [Git][BuildStream/buildstream][master] 5 commits: element.py: Remove early warning and check directory is not None



Title: GitLab

Jim MacArthur pushed to branch master at BuildStream / buildstream

Commits:

4 changed files:

Changes:

  • buildstream/_artifactcache/cascache.py
    ... ... @@ -348,19 +348,29 @@ class CASCache(ArtifactCache):
    348 348
             return pushed
    
    349 349
     
    
    350 350
         def push_directory(self, project, directory):
    
    351
    +        """ Push the given virtual directory to all remotes.
    
    352
    +
    
    353
    +        Args:
    
    354
    +            project (Project): The current project
    
    355
    +            directory (Directory): A virtual directory object to push.
    
    356
    +
    
    357
    +        Raises: ArtifactError if no push remotes are configured.
    
    358
    +        """
    
    351 359
     
    
    352 360
             push_remotes = [r for r in self._remotes[project] if r.spec.push]
    
    353 361
     
    
    362
    +        if not push_remotes:
    
    363
    +            raise ArtifactError("CASCache: push_directory was called, but no remote artifact " +
    
    364
    +                                "servers are configured as push remotes.")
    
    365
    +
    
    354 366
             if directory.ref is None:
    
    355
    -            return None
    
    367
    +            return
    
    356 368
     
    
    357 369
             for remote in push_remotes:
    
    358 370
                 remote.init()
    
    359 371
     
    
    360 372
                 self._send_directory(remote, directory.ref)
    
    361 373
     
    
    362
    -        return directory.ref
    
    363
    -
    
    364 374
         def push_message(self, project, message):
    
    365 375
     
    
    366 376
             push_remotes = [r for r in self._remotes[project] if r.spec.push]
    

  • buildstream/element.py
    ... ... @@ -2137,14 +2137,11 @@ class Element(Plugin):
    2137 2137
             project = self._get_project()
    
    2138 2138
             platform = Platform.get_platform()
    
    2139 2139
     
    
    2140
    -        if self.__remote_execution_url and self.BST_VIRTUAL_DIRECTORY:
    
    2141
    -            if not self.__artifacts.has_push_remotes(element=self):
    
    2142
    -                # Give an early warning if remote execution will not work
    
    2143
    -                raise ElementError("Artifact {} is configured to use remote execution but has no push remotes. "
    
    2144
    -                                   .format(self.name) +
    
    2145
    -                                   "The remote artifact server(s) may not be correctly configured or contactable.")
    
    2146
    -
    
    2147
    -            self.info("Using a remote sandbox for artifact {}".format(self.name))
    
    2140
    +        if (directory is not None and
    
    2141
    +            self.__remote_execution_url and
    
    2142
    +            self.BST_VIRTUAL_DIRECTORY):
    
    2143
    +
    
    2144
    +            self.info("Using a remote sandbox for artifact {} with directory '{}'".format(self.name, directory))
    
    2148 2145
     
    
    2149 2146
                 sandbox = SandboxRemote(context, project,
    
    2150 2147
                                         directory,
    

  • buildstream/sandbox/_sandboxremote.py
    ... ... @@ -173,8 +173,8 @@ class SandboxRemote(Sandbox):
    173 173
             platform = Platform.get_platform()
    
    174 174
             cascache = platform.artifactcache
    
    175 175
             # Now, push that key (without necessarily needing a ref) to the remote.
    
    176
    -        vdir_digest = cascache.push_directory(self._get_project(), upload_vdir)
    
    177
    -        if not vdir_digest or not cascache.verify_digest_pushed(self._get_project(), vdir_digest):
    
    176
    +        cascache.push_directory(self._get_project(), upload_vdir)
    
    177
    +        if not cascache.verify_digest_pushed(self._get_project(), upload_vdir.ref):
    
    178 178
                 raise SandboxError("Failed to verify that source has been pushed to the remote artifact cache.")
    
    179 179
     
    
    180 180
             # Set up environment and working directory
    

  • tests/artifactcache/push.py
    ... ... @@ -228,9 +228,9 @@ def _test_push_directory(user_config_file, project_dir, artifact_dir, artifact_d
    228 228
             directory = CasBasedDirectory(context, ref=artifact_digest)
    
    229 229
     
    
    230 230
             # Push the CasBasedDirectory object
    
    231
    -        directory_digest = cas.push_directory(project, directory)
    
    231
    +        cas.push_directory(project, directory)
    
    232 232
     
    
    233
    -        queue.put(directory_digest.hash)
    
    233
    +        queue.put(directory.ref.hash)
    
    234 234
         else:
    
    235 235
             queue.put("No remote configured")
    
    236 236
     
    



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