I don't quite remember if Pants can be told to cac...
# general
f
I don't quite remember if Pants can be told to cache results of the
run
goal? ๐Ÿงต
Say I have a deterministic Python script that is guaranteed to produce bit by bit identical output given the same input, it has no side effects etc, e.g. it reads a file from disk and saves a new file on disk. If I have run
run
on an input file and then
run
it again, the very same command (with input data unchanged), it would be nice to fetch the output file from the cache. If that helps, I can make both input and output to reside in the build workspace. I don't want to write an own codegen which would help with that. ๐Ÿ™‚ and I'd love to avoid adding an own little cache with something like https://joblib.readthedocs.io/.
f
Invoke it as an
adhoc_tool
?
๐Ÿ™ 1
although you want the output written to disk
b
We hack around the lack of https://github.com/pantsbuild/pants/discussions/18235 by using adhoc_tool to run the thing, and then have a
run_shell_command
that just copies the file. Ie the heavy work (running the script) is cached, but the writing to disk isnโ€™t.
๐Ÿ’— 1
f
oh that's brilliant, Huon, I'll explore this!