-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
experimental_shell_command
's sandbox and invalidation includes transitive dependencies of experimental_shell_command
dependencies, not just outputs
#17345
Labels
Comments
Started a discussion here: #17368 |
FWIW This is part of my "re-architect dependencies" proposal I'm hoping to work on late this year or Q1 next year 😄 |
#17680 and follow-up work will have some impact on this |
chrisjrn
pushed a commit
to chrisjrn/pants
that referenced
this issue
Dec 7, 2022
…_command` Replaces the `outputs` field, which has a usability issue demonstrated in pantsbuild#17345
chrisjrn
pushed a commit
that referenced
this issue
Dec 9, 2022
As seen in #17345, `experimental_shell_command` has a confused notion of dependencies. There are the "runtime dependencies": those needed to successfully run the command (essentially input data or runnable binaries), and then there are the dependencies that are necessary to use the side-effects generated by the command. `esc` currently treats these identically, which means that the sandboxes for chains of commands get overly large, and their cache invalidations overly fine (due to so many dependencies). This adds a `SpecialCasedDependencies` field to `experimental_shell_command`, called `execution_dependencies`. `execution_dependencies` are used to populate the sandbox, but are not fetched when `TransitiveTargetsRequests` are made by subsequent targets; `dependencies` is now deprecated and replaced with `output_dependencies`, which are the dependencies necessary for successfully consuming the outputs of the `experimental_shell_command`. To make it easier to migrate, if `dependencies` are specified _without_ declaring `execution_dependencies`, a deprecation warning will be raised explaining how to upgrade. Closes #17345
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When a
experimental_shell_command
(:second
) depends on anotherexperimental_shell_command
(:first
), the sandbox for:second
include the dependencies of:first
, rather than just the output of:first
.https://gist.github.com/huonw/c55d0b387ed6030cda611898ee2d0361 provides a reproducer, where
:first
generatesoutput.txt
by 'consuming'input.txt
(but does nothing with it), and:second
includes asleep
to demonstrate when it is running. Thearchive
package includes all the.txt
files that ended in the sandbox for:second
: I'd expect it to only be the direct output of:first
(output.txt
), not theinput.txt
dependency of:first
.BUILD file from that gist for convenience:
AFAICT, there's no way to break
:second
's importing of:input
, e.g. adjusting todependencies=[":first", "!:input"]
doesn't do anything: the behaviour is the same (and using!!:input
isn't supported).The
:input
beingfile
is just for convenience. This appears to apply to all other target types, e.g. apex_binary
or yet anotherexperimental_shell_command
.I haven't checked how this behaves when depending on explicit codegen targets, only these adhoc
experimental_shell_command
ones.Pants version
2.13.0
OS
macOS
Additional info
Background: how are we using
experimental_shell_command
to hit this?We're using
experimental_shell_command
to try to bridge the gap between Pants supported code and unsupported code (JS/TS), as well as for adhoc codegen tasks (to avoid avoid having to write and maintain a plugin). This can result in 'long' chains ofexperimental_shell_command
s that depend on each other (and other resources), e.g.:The Python code that goes into
pex_binary
changes regularly and thus the PEX itself changes too, but the exportedschema.json
doesn't change so much (i.e. we're often refactoring/adding features/fixing bugs without changing the schema). In theory, if:app
changes but the schema doesn't,:schema
's dependees (:codegen-from-schema
,:docs-from-schema
) don't need to run, but those dependees pull in theapp.pex
file from:app
, and thus do rerun. Rerunning can take significant time.(See also: https://pantsbuild.slack.com/archives/C046T6T9U/p1666315386420799)
The text was updated successfully, but these errors were encountered: