https://pantsbuild.org/ logo
#general
Title
# general
a

adventurous-judge-80222

02/08/2022, 9:31 PM
I could use some help debugging the remote caching server. I have a local instance of the buildfarm build-server running off of this documentation and my pants.toml configured like:
Copy code
remote_cache_read = true
remote_cache_write = true
remote_store_address = "<grpc://localhost:8980>"
remote_instance_name = "memory"
I could use help figuring out if the pants build actually hits the running remote cache instance.
h

high-yak-85899

02/08/2022, 9:36 PM
If you don't get errors at the top of your goals, then in my experience, it's hitting it.
One way I tested my stuff was to run something so that it populates the cache and then immediately rerun it with
--local-cache=False
or whatever the flag was.
Sorry,
--no-local-cache
👍 1
I was testing using
./pants test
and, in the test summary, you'll see
(cached remotely)
when it has pulled from the remote.
By errors at the top, I mean it will report things like dns lookups and such
a

adventurous-judge-80222

02/08/2022, 9:41 PM
Thanks that looks like it is working then, couldn't believe it myself. So say I'm using the remote cache and building a docker image, does that mean there's a copy of the built docker image in the remote cache instance?
h

high-yak-85899

02/08/2022, 9:43 PM
I would assume so. I didn't see anything for configuring what does or doesn't hit the cache. But all of these systems clear the cache based on least recently used basis so that would take up a couple hundred MB (or a few GB depending on image) at one time and then probably quickly get pushed out of the cache from tests and other things that get run/accessed more frequently.
f

fast-nail-55400

02/08/2022, 9:46 PM
add
--stats-log
to your Pants invocation to view the internal counters Pants has
🧠 2
👍 2
if the remote cache counters are non-zero, then it accessed the remote cache
specifically these counters: •
remote_cache_requests
— total number of requests to remote cache • `remote_cache_requests_cached`— number of requests where there was a cache hit •
remote_cache_requests_uncached
— number of requests where there was a cache miss
a

adventurous-judge-80222

02/08/2022, 9:55 PM
Thanks that's very helpful. I'm going to play with the remote server a bit because it looks like its not storing the docker image artifacts. Though it is getting hit.
Copy code
remote_cache_requests: 4
  remote_cache_requests_cached: 0
  remote_cache_requests_uncached: 4
As you mentioned @high-yak-85899 its probably getting evicted due to its size. My end goal is to prototype a configuration where the client does not have the docker images in its local cache.
h

high-yak-85899

02/08/2022, 9:56 PM
Reliably storing container images should be left to something like a container registry imo.
a

adventurous-judge-80222

02/08/2022, 10:01 PM
@high-yak-85899 that sounds right, gonna read some more documentation and think about it.
f

fast-nail-55400

02/08/2022, 10:02 PM
The remote cache key is the hash of the encoded protobuf form of the
Process
executed by Pants. (The protobufs involved are the
Action
and
Command
protos from the Remote Execution API.) Enable debug logging with
-ldebug
and see if the
Process
invocation by Pants have some difference which would vary their content from run to run.
Also the Pants remote cache does not include Docker images. Docker has its own cache for those, and Pants currently knows nothing about Docker’s cache.
👍 1
h

hundreds-father-404

02/08/2022, 10:11 PM
Further, building a Docker image intentionally isn't cached: https://github.com/pantsbuild/pants/pull/13464 I recommend using something like
./pants lint
or
./pants test
when debugging remote caching
h

high-yak-85899

02/08/2022, 10:13 PM
But the pex binaries that would be copied into an image would be cached, right?
1
h

hundreds-father-404

02/08/2022, 10:14 PM
Correct
6 Views