| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
As a rule, throughout the codebase we should not be using internal
ProvenanceInformation objects in our APIs, but rather Node objects.
This is because ProvenanceInformation is generated on the fly from
a Node object, and it is needlessly expensive to instantiate one before
it is absolutely needed.
This patch unilaterally fixes the codebase to pass `provenance_node`
Node objects around as arguments rather than `provenance` ProvenanceInformation
objects.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Refactored this to remove unneeded complexity in the code base,
as described here:
https://lists.apache.org/thread.html/r4b9517742433f07c79379ba5b67932cfe997c1e64965a9f1a2b613fc%40%3Cdev.buildstream.apache.org%3E
Changes:
* source.py: Added private Source._cache_directory() context manager
We also move the assertion about nodes which are safe to write to
a bit lower in Source._set_ref(), as this was unnecessarily early.
When tracking a workspace, the ref will be none and will turn out
to be none afterwards, it is not a problem that a workspace's node
is a synthetic one, as tracking will never affect it.
* local plugin: Implement get_unique_key() and stage() using
the new context manager in order to optimize staging and
cache key calculations here.
* workspace plugin: Implement get_unique_key() and stage() using
the new context manager in order to optimize staging and
cache key calculations here.
* trackqueue.py: No special casing with Source._is_trackable()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The `directory` value determines where a source is staged within the
build root of an element, however, it does not directly affect
individual sources.
With this change the sources will individually be cached in CAS
independent of the value of `directory`. `ElementSources` will use the
value of `directory` when staging all element sources into the build
root.
This results in a cache key change as the `directory` value is moved
from the unique key of individual sources to the unique key of
`ElementSources`.
This is in preparation for #1274.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sources have been cached in CAS individually, except for sources that
transform other sources, which have been cached combined with all
previous sources of the element. This caching structure may be confusing
as sources are specified in the element as a list and this is not a good
fit for #1274 where we want to support caching individual sources in a
Remote Asset server with a BuildStream-independent URI (especially the
`directory` configuration would be problematic).
This replaces the combined caching of 'previous' sources with an
element-level source cache, which caches all sources of an element
staged together. Sources that don't depend on previous sources are still
cached individually.
This also makes it possible to add a list of all element sources to the
source proto used by the element-level source cache.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This dramatically affects the load process and removes one
hoop we had to jump through, which is the creation of the extra
intermediate MetaElement objects.
This allows us to more easily carry state discovered by the Loader
over to the Element constructor, as we need not add additional state
to the intermediate MetaElement for this. Instead we have the Element
initializer understand the LoadElement directly.
Summary of changes:
* _loader/metaelement.py: Removed
* _loader/loadelement.py: Added some attributes previously required on
MetaElement
* _loader/loader.py: Removed _collect_element() and collect_element_no_deps(),
removing the process of Loader.load() which translates LoadElements into
MetaElements completely.
* _loader/init.py: Export LoadElement, Dependency and Symbol types, stop
exporting MetaElement
* _loader/metasource.py: Now take the 'first_pass' parameter as an argument
* _artifactelement.py: Use a virtual LoadElement instead of a virtual
MetaElement to instantiate the ArtifactElement objects.
* _pluginfactory/elementfactory.py: Adjust to now take a LoadElement
* _project.py: Adjust Project.create_element() to now take a LoadElement,
and call the new Element._new_from_load_element() instead of the
old Element._new_from_meta() function
* element.py:
- Now export Element._new_from_load_element() instead of Element._new_from_meta()
- Adjust the constructor to do the LoadElement toplevel node parsing instead
of expecting members on the MetaElement object
- Added __load_sources() which parses out and creates MetaSource objects
for the sake of instantiating the element's Source objects. Consequently
this simplifies the scenario where workspaces are involved.
* source.py: Adjusted to use the new `first_pass` parameter to MetaSource when
creating a duplicate clone.
|
|
|
|
|
| |
These __meta_kind members are documented as relevant for pickling, which
was removed a short while ago.
|
|
|
|
|
|
|
| |
`_is_cached()` is indirectly called by the frontend, which is not
optimal for handling per-plugin errors. Instead, call `validate_cache()`
right before the cache is used: in fetch jobs and when opening a
workspace.
|
| |
|
|
|
|
|
| |
This automatically expands the variables from the element into
the sources config
|
|
|
|
| |
Also fix linting errors coming with new version of pylint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This does not make sense to keep in the public API surface
documentation. As we are heading towards a release of 2.0, this
represents a "reset" in public API, and older annotations only
serve to clutter the documentation with information that is not
relevant to the reader.
Everything which is public at the time of the 2.0 release can
be considered available "Since: 2.0" implicitly (as this is
going to be the starting point of this new stable API).
It will make sense to start adding these annotations again for any
added API in 2.2 and forward.
|
|
|
|
|
|
|
| |
Plugin tests are already accessing this API, but using imports from
private modules. For motivation for this to be exposed publicly, note
that ErrorDomain is an argument for most things in runcli.py, and
LoadErrorReason may be another.
|
|
|
|
|
| |
This is not needed now that we have 'is_resolved' and 'is_cached'.
We can therefore drop all calling places and implementations of it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes the need to use consistency in Sources, by asking
explicitely whether the source is cached or not.
This introduces a new public method on source: `is_cached` that needs
implementation and that should return whether the source has a local
copy or not.
- On fetch, also reset whether the source was cached or set if as
cached when we know it was.
- Validate the cache's source after fetching it
This doesn't need to be run in the scheduler's process and can be
offloaded to the child, which will allow better multiprocessing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`get_consistency` is coarse grained and hard to optimize, in addition
to being un-userfriendly.
This adds a new `is_resolved` that has for default implementation
`get_ref() is not None`, which is true for most sources in BuildStream.
Sources for which this is not true can override the method to give a
more accurate description.
Checking for this before looking whether the source is cached can
reduce the amount of work necessary in some pipeline and opens the
door for more optimizations and the removal of the source state check.
|
|
|
|
|
|
|
|
| |
`get_consistency` doesn't allow being fine grained and asking only for a
specific bit of information.
This introduces methods `is_cached` and `is_resolved` which will be more
flexible for refactoring.
|
|
|
|
|
| |
Newer version of pylint detect when a comprehension would not be needed.
Let's remove all the ones that are indeed extraneous
|
|
|
|
|
|
|
|
|
|
| |
These were caused by unhandled errors from plugins when calling
`Source.get_consistency()`. This doesn't really solve the problem,
since that interface is still used un-wrapped elsewhere, but it
enables removing `Element.__schedule_tracking()` and fixes a bug.
Ultimately we'd like to remove `Source.get_consistency()`, so this
isn't too long-term of a problem.
|
|
|
|
|
|
|
| |
As discussed over the mailing list, reformat code using Black. This is a
one-off change to reformat all our codebase. Moving forward, we
shouldn't expect such blanket reformats. Rather, we expect each change
to already comply with the Black formatting style.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This method reports whether the source can be tracked. This would be
false for sources advertising BST_KEY_REQUIRES_STAGE.
Element tracking can be skipped if none of the held sources can be
tracked. This is determined by the value of the
`Element.__tracking_scheduled` attribute which is set in
`Element._schedule_tracking()`. This is set to `True` if at least one
source can be tracked.
Also remove some of the tracking handling from `_stream._load` to
`_stream.track` where it is more relevant.
closes #1186
|
|
|
|
|
|
|
|
| |
`Stream.shell()` should check that the element's sources are cached
before calling the shell. If the sources are not cached raise a
StreamError and recommend a fetch.
closes #1182
|
|
|
|
| |
Correct version number for BST_KEY_REQUIRES_STAGE
|
|
|
|
|
| |
Ensure that sources advertising BST_NO_PRESTAGE_KEY have keys after
tracking.
|
|
|
|
|
|
|
|
|
|
| |
Extend Source API
Add `_stage_into_cas()` private method. Calls `self.stage` on
a `CasBasedDirectory`.
If the source sets BST_NO_PRESTAGE_KEY then the casdir is recreated from
a stored digest and imported directly in `_stage`.
|
| |
|
|
|
|
|
|
|
|
|
| |
Remove the need for plugins to find and return the factory they came
from. Also take the opportunity to combine source and element pickling
into a single 'plugin' pickling path.
This will make it easier for us to later support pickling plugins from
the 'first_pass_config' of projects.
|
|
|
|
|
| |
'strip_node_info' would be useful for multiple plugins. We should
therefore allow users to use it.
|
|
|
|
| |
This is now handled in Context.prepare_fork().
|
|
|
|
| |
This aligns the method name with has_open_grpc_channels().
|
|
|
|
|
|
|
|
|
| |
Remove XFAIL mark from test_workspace_visible and remove the explicit
SourceCache.commit() in the workspace source plugin. Allow buildstream
to handle the commit logic.
Add handling for non-cached workspace sources in
`source.Source._generate_keys()`.
|
|
|
|
|
|
|
|
|
|
| |
As a first step, add type hints to variables whose type `mypy` cannot
infer automatically. This is the minimal set of type hints that allow
running `mypy` without any arguments, and having it not fail.
We currently ignore C extensions that mypy can't process directly.
Later, we can look into generating stubs for such modules (potentially
automatically).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adding the element full name and display key into all element related
messages removes the need to look up the plugintable via a plugin
unique_id just to retrieve the same values for logging and widget
frontend display. Relying on plugintable state is also incompatible
if the frontend will be running in a different process, as it will
exist in multiple states.
The element full name is now displayed instead of the unique_id,
such as in the debugging widget. It is also displayed in place of
'name' (i.e including any junction prepend) to be more informative.
|
|
|
|
|
|
|
|
|
| |
Pave the way toward supporting the 'spawn' method of creating jobs, by
adding support for pickling ChildJobs. Introduce a new 'jobpickler'
module that provides an entrypoint for this functionality.
This also makes replays of jobs possible, which has made the debugging
of plugins much easier for me.
|
|
|
|
|
| |
This variable is accessed multiple times per run and can be slow on
slow file systems.
|
|
|
|
|
| |
We need to update every place where we were passing a yaml 'dict' to
now pass a 'MappingNode'
|
|
|
|
|
|
|
|
| |
A 'clone' operation has an implicit understanding that it is expensive,
which is not the case of a 'copy' operation, which is more usually
a shallow copy.
Therefore renaming to 'clone'
|
| |
|
|
|
|
|
|
|
| |
- _composite -> __composite (internal)
- composite -> _composite (BuildStream private)
- composite_under -> _composite_under (BuildStream private)
- get -> _get (internal)
|
|
|
|
|
| |
Users should not need to get access to any of those, and should only
need access to the ProvenanceInformation to print it.
|
|
|
|
|
|
|
|
| |
This replaces the helper method by adding a 'get_provenance' on the node
directly
- Adapt all call sites
- Delay getting provenance wherever possible without major refactor
|
|
|
|
| |
- adapt all call sites to use the new API
|
|
|
|
|
| |
- Also take care of node_composite_move in the same way.
- Adapt all calling places
|
| |
|
|
|
|
|
|
|
|
|
| |
Some call places do not need calls to 'node_sanitize' anymore, therefore
removing the call entirely.
Other still use it for convenience, but that doesn't seem the right way
to do it for consistency. Those places have been replaced by calls to
'Node.strip_node_info()'.
|
| |
|
|
|
|
|
|
|
| |
- node_find_target with 'key' is only used once in the codebase.
We can remove and simplify this function
- Allow 'MappingNode.get_node()' to be called without any
'expected_types'
|
|
|
|
| |
Also adaprt every part of the code calling it
|
|
|
|
|
|
|
|
| |
This allows to get a mapping node from another 'MappingNode',
replacing 'node_get(my_mapping, key, type=dict)'
Also changes all places where 'node_get' was called like that by
the new API.
|
| |
|
|
|
|
|
|
|
|
|
| |
This changes the location of source refs from `cache/cas/refs` to
`cache/sources_protos` and fixes tests that looked in the old reference
place. Source cache now uses the new protocol buffer and grpc methods
defined, for storing locally, and pushing and pulling to remotes.
Part of #1038
|