The `--format` option relied on `click.Context.get_parameter_source` to
determine if the default value for the `--format` parameter was passed.
A bug in click caused this to behave "correctly", click 8.4.0 fixed the
bug. Change the logic by using `None` as the default value so that it
can be checked without using the parameter source.
Add two situations where the cache is pruned on startup, removing all
the cached objects from storage:
1. the version field does not match the current one
2. the model has been changed out of band
The second one is very important as it allows to use the revng2 CLI
while editing the model manually on disk.
Overhaul the pipeline configuration logic by collapsing all dynamic
configuration options, both for analyses and pipes into a single
dictionary. Change all the interfaces so that there is no longer
distinction between the configuration of an analysis and of pipes.
Expose these options to the command line via `--{name}-configuration`
options for each pipe/analysis that is applicable to the command-line
invocation.
Ignore `OSError`s in `LocalStorageProvider` when rebuilding the list of
files for a given hash, since those paths might have become inaccessible
in the meantime.
Click clamps the output of its help to 80 columns, this makes reading
the help on wider terminals quite annoying. Change the formatter class
used to allow better help output on wider terminals.
Add an additional piece of metadata that states which pipes are used to
compute a specific artifact. This can be used to derive which
configuration options influence the creation of an artifact.
Rework the artifact endpoint, making it similar to the CLI invocation.
It now works on a single artifact and can be made to return both `json`
and `tar` as formats.
Change the `Container.serialize` interface so that it is possible to
supply a list of objects that will be serialized instead of all the ones
in the container.
Add two additional fields to `Artifact`: `defined_locations` and
`preferred_artifacts`. These are pieces of metadata that allow
navigation between multiple PTML-enabled documents.
Add categories in the pipeline, allow an artifact to have a category
specified which allows it to be shown or hidden by default. Adapt the
CLI tools to hide artifacts of the category that don't
`show_by_default=True`.
Since most functions in `pipeline_parser.py` had a lot of redundancy in
the parameters passed, convert all of them to be part of a
`PipelineParser` class which stores all the variables.
Rework which information is transmitted in the pipeline metadata,
avoiding redundancy and moving some information there instead of
returning it every time a request is made.
Before this commit the `invalidate` code did invalidate all the objects
but left all the rows in `dependencies` that were paired to the produced
objects except the invalidated paths.
In this commit the logic is changed to be done in 3 steps:
1. SELECT all the objects that need to be invalidated, write down their
rowid
2. Delete all the rows in `dependencies` that were produced in
conjunction to the objects from (1)
3. Remove the objects from the table, returning invalidation data
This guarantees that the database does not accumulate invalidation data
over time due to invalidations.
Change the `get_model` and `set_model` interface of `StorageProvider` so
that it is responsibility of the `StorageProvider` to
serialize/deserialize the model before returning to the caller.
This is in preparation to the model migration being implemented, since
it's now a responsibility of the storage provider to deserialize it it
can trivially re-save it to disk if it is migrated.
Overhaul the logic and method names involved in enabling and disabling
reference caching in `TupleTree<T>`. `TupleTreeReference<T, U>` now
lazily caches the target and will traverse the path only when needed.
Also expose and use these functions in the new pipeline, which should
provide some speedup when executing a `Schedule`.
The functions that take care of running an analysis/analysis list have a
lot of duplication, merge the two into a single function that takes care
of running both.
Fix the code that handles setting the `--format`, `--tar` and `--yaml`
command line options, which incorrectly wrote to the `format` kwargs
instead of the `container_format` one.
Instead of executing `chdir` when using the `-C` option, which is
fragile when other paths are involved, store the option in the click
context and propagate it to the required code paths that require knowing
what the base directory is.
Allow the storage provider to be initialized with `local://?inline`.
This will set the cache directory to `$PWD/.cache` instead of
`~/.cache/revng`. This is to simplify testing for pypeline.
Add the functionality the the pipeline infrastructure and CLI to run
individual pipe and analyses as subcommands instead of in-process. This
allow better debuggability of individual pipes.
In preparation for debugging individual pipes add an additional method
to the `Pipe` interface, `needed_files`, which allows the pipe to
statically report which files it will request ahead of time.
Convert the `RuntimeError`s emitted by the pipebox (e.g. when checking
preconditions or running analyses) into `PypelineError`s and have the
pypeline cli infrastructure handle them gracefully, without emitting
stacktraces.
Add infrastructure to pypeline that allows containers to be notified
when they are being used last, this allows two things:
* `Pipe`s eagerly clearing those containers once they are done reading
their contents
* `ScheduledTask`s clearing those out at the end of their execution in
case the pipe did not do it
This overall should improve memory usage as container no longer take up
memory if they are no longer used as part of a `Schedule`.
Inline the body of `PipelineNode.run` into `ScheduledTask.run`, making
`PipelineNode` a pure data structure. This also allows eliding all the
arguments since all of them as properties of `ScheduledTask`.