nathanwilliams-ct commented on code in PR #2147:
URL: https://github.com/apache/buildstream/pull/2147#discussion_r3903264934
##########
src/buildstream/element.py:
##########
@@ -2076,6 +2091,17 @@ def _shell(self, scope=None, *, mounts=None,
isolate=False, prompt=None, command
if prompt is not None:
environment["PS1"] = prompt
+ with self.timed_activity("Staging other_targets",
silent_nested=True), self.__collect_overlaps(sandbox):
+ self.stage_dependency_artifacts(sandbox, other_elements)
+
+ if other_elements:
+ # Stage artifacts from other_elements into the sandbox.
+ for element in other_elements:
+ # Stage deps in the sandbox root
+ with element.timed_activity("Integrating sandbox"),
sandbox.batch():
+ for dep in element._dependencies(_Scope.RUN):
+ dep.integrate(sandbox)
Review Comment:
It might be nice to have a 'reload' method on Element that can cleanly
reload the element if there are changes at runtime, but it would involve some
heavy refactoring that I currently don't have the context to do. Element is
heavily implemented around the idea of everything is immutable.
We could almost do with a replacing the whole Element class with an explicit
state machine to represent elements at different stages of it's lifecycle.
There are so many Optional fields and 'state' booleans, it's difficult to
untangle and work out which state the element is currently in, and what order
to call things in etc.
<img width="535" height="675" alt="image"
src="https://github.com/user-attachments/assets/a45c8cd0-71ce-4a3c-a7ed-a93aa312681c"
/>
```plantuml
[*] --> LoadElement: Load from YAML
LoadElement --> WeakElement: Calculate weak cache key
WeakElement --> StrongElement: Resolve dependencies and calculate strong key
StrongElement --> CachedElement: Element has cached artifacts
StrongElement --> PreparedElement: Prepare sources and dependencies for a
build
PreparedElement --> CachedElement: Build the element
PreparedElement --> FailedBuildElement: cache buildtree
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]