square-psychiatrist-19087
05/05/2024, 5:48 PMGet(Process, ...) that runs a script that generates some binary and writes an absolute path to that binary in stdout. Then I want to use that binary to create RunRequest and then use it in adhoc_tool. There are two caveats though: 1) I can't put the produced binary into the Digest (for reasons) and 2) the generated binary might disappear and I might need to generate it again. I tried to solve these issues with ProcessCacheScope.PER_SESSION and it works, but now when I run my adhoc_tool that uses the generated binary it never caches the result and has to run every time even though I can guarantee that the generated binary is always the same. So the question is - is there a way to tell pants to build the binary if it doesn't exist, but stop pants from recalculating every downstream dependency of the binary?gorgeous-winter-99296
05/05/2024, 7:35 PMPER_RESTART_SUCCESSFUL instead, maybe? Would get you better caching while pantsd lives.square-psychiatrist-19087
05/05/2024, 7:39 PMProcessCacheScope.ALWAYS, for example, I generate the binary from some sources, and if I use this binary in a test I want the result of the test to be cached if the sources didn't changesquare-psychiatrist-19087
05/05/2024, 7:39 PMsquare-psychiatrist-19087
05/05/2024, 7:41 PMsquare-psychiatrist-19087
05/05/2024, 7:44 PMgorgeous-winter-99296
05/05/2024, 7:50 PMgorgeous-winter-99296
05/05/2024, 7:52 PMsquare-psychiatrist-19087
05/05/2024, 8:11 PMI don't quite understand the problem you're trying to solveHere is what I'm up to https://github.com/pantsbuild/pants/pull/20873
gorgeous-winter-99296
05/05/2024, 8:12 PMsquare-psychiatrist-19087
05/05/2024, 8:15 PMsquare-psychiatrist-19087
05/05/2024, 8:17 PMsquare-psychiatrist-19087
05/05/2024, 8:19 PMnix_binary(
name="dot",
expr='(import (fetchTarball "<https://github.com/NixOS/nixpkgs/archive/06278c77b5d162e62df170fec307e83f1812d94b.tar.gz>") {}).graphviz',
rel_path="bin/dot",
)
and it uniquely identifies the binary. If the source didn't change, then everything downstream could be cached even if the binary is not there yet (but you regenerate it)gorgeous-winter-99296
05/05/2024, 8:20 PMgorgeous-winter-99296
05/05/2024, 8:22 PMsquare-psychiatrist-19087
05/05/2024, 8:23 PMgorgeous-winter-99296
05/05/2024, 8:24 PMsquare-psychiatrist-19087
05/05/2024, 8:24 PMgorgeous-winter-99296
05/05/2024, 8:25 PMenv=FrozenDict(__HACK_CACHE_BUST=str(time.time()))gorgeous-winter-99296
05/05/2024, 8:29 PMsquare-psychiatrist-19087
05/05/2024, 8:46 PMenv=FrozenDict(__HACK_CACHE_BUST=str(time.time()))Do you mean
await Get(ProcessResult, Process(..., env=FrozenDict(__HACK_CACHE_BUST=str(time.time()))?
I thought pants invalidates downstream targets cache if env changes, no? Then how does it know to rerun the rules when some other input changes?