-
-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include/exclude and heuristic-based immutable_inputs
#17282
Comments
In the most common case (fixers) couldn't we deduce the mutable paths by the intersection of the input and output paths? The output paths for any process will either a) not exist yet or b) do exist (from the inputs) and therefore need to be mutable (or else why are you capturing them) |
Yea, for sure. |
Fixes #17282 and fixes #14070 This change represents the smallest footprint change to get support in for treating "large" files as immutable inputs. - `immutable_inputs.rs` has been moved to `store` (to avoid circular reference) - An additional method was added to support a hardlink _file_ - Directory materialization takes an `ImmutableInputs` ref and a list of paths to ensure mutable - When materializing a file, if its above our threshold and not being forced mutable, we hardlink it to the immutable inputs - Process running seeds the mutable paths with the capture outputs The future is primed for changes like: - Eventually removing the `immutable_input_digests` to a process, and letting the heuristic take over - And then cleaning the code up after that's ripped out - Adding more facilities to includelist/excludelist files from a `Process` object (e.g. we could includelist most/all PEXs since those shouldn't be mutated and we'd just have one top-level hardlink) - Have a directory huerstic - IDK more shenanigans 😄 Tested 3 ways: - `./pants --keep-sandboxes=always <something>` and inspected the sandbox between 2 different runs using the same daemon and ensured the hardlink - Crafted an `experimental_shell_command` with a file in `outputs` that matches a large file and ensured the file in the sandbox wasn't hardlinked - Crafted an `experimental_shell_command` with a dir in `outputs` that matches the containing dir of a large file and ensured the file in the sandbox wasn't hardlinked
Process.immutable_inputs
is currently configured as a mapping from a file path to aDigest
to materialize at that path. It is merged into theinput_digest
of aProcess
to form a "complete"Digest
of inputs.But this separation is a bit unfortunate, because it means that using
immutable_inputs
(which should be fairly widely used: see discussion on #14070) means a lot of change to how yourProcess
is constructed.From an API-changes perspective, we should:
immutable_inputs
list into a flat list of paths which should be forced/includelisted to be materialized as immutable (regardless of the heuristic from above), but which must already exist in theinput_digest
(maybe "force" should go in the name?force_immutable_paths=
...?).Process
is constructed to stop adding an input to theinput_digests
and instead add it to theimmutable_inputs
as a dict), you would only need to add a path to theimmutable_inputs
, without changing yourinput_digest
.mutable_inputs
(orforce_mutable_paths=
...?) flat list of paths to act as an excludelist that prevents a path from being materialized as a symlink.From an implementation perspective, this would look like moving the support for creating the symlinks for
ImmutableInputs
from an explicit step before running a process:pants/src/rust/engine/process_execution/src/local.rs
Lines 641 to 662 in 08410e5
...to a thing that happens inside
fn materialize_directory
when an includelisted path is encountered:pants/src/rust/engine/fs/store/src/lib.rs
Lines 1188 to 1201 in 08410e5
materialize_directory(_helper)
would take either:directory::Entry
s / paths to includelist...and a reference to
ImmutableInputs
, and then would create a symlink to theImmutableInputs
whenever it encountered one of the includelisted paths.The text was updated successfully, but these errors were encountered: