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 2021/01/17 09:41:14 UTC

[buildstream] 02/03: element.py: Remove local __remote_execution_specs instance variable

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

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

commit 248e71a455a605ac1170b6d068efa0baddd15381
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Sat Jan 16 19:17:32 2021 +0900

    element.py: Remove local __remote_execution_specs instance variable
    
    Caching this variable locally only adds additional redirection and
    confusion around where these are coming from, making the code more
    difficult to understand.
---
 src/buildstream/element.py | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 945ca5c..dbb5aeb 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -2706,14 +2706,6 @@ class Element(Plugin):
 
         return self.__tainted
 
-    # __use_remote_execution():
-    #
-    # Returns True if remote execution is configured, defaults to user defined
-    # project-specific overrides, project config, or global user config.
-    #
-    def __use_remote_execution(self):
-        return bool(self.__remote_execution_specs)
-
     # __collect_overlaps():
     #
     # A context manager for collecting overlap warnings and errors.
@@ -2755,7 +2747,7 @@ class Element(Plugin):
         else:
             output_node_properties = None
 
-        if directory is not None and allow_remote and self.__use_remote_execution():
+        if directory is not None and allow_remote and project.remote_execution_specs:
 
             self.info("Using a remote sandbox for artifact {} with directory '{}'".format(self.name, directory))
 
@@ -2769,7 +2761,7 @@ class Element(Plugin):
                 stdout=stdout,
                 stderr=stderr,
                 config=config,
-                specs=self.__remote_execution_specs,
+                specs=project.remote_execution_specs,
                 output_files_required=output_files_required,
                 output_node_properties=output_node_properties,
             )
@@ -2841,12 +2833,6 @@ class Element(Plugin):
 
         self._configure(self.__config)
 
-        # Extract remote execution URL
-        if load_element.first_pass:
-            self.__remote_execution_specs = None
-        else:
-            self.__remote_execution_specs = project.remote_execution_specs
-
         # Extract Sandbox config
         sandbox_config = self.__extract_sandbox_config(project, load_element)
         self.__variables.expand(sandbox_config)