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

average-sugar-76469

01/14/2019, 10:28 PM
What’s the difference between cache_key’s and fingerprints? The cache_key contains the fingerprint? +plus something else if I remember correctly. Trying to understand the differences/unions between the 2 values below.
Copy code
versioned_target.cache_key.hash.split(-1)
versioned_target.target.playload.fingerprint()
a

aloof-angle-91616

01/14/2019, 10:31 PM
if you're discussing the result of a
self.invalidated()
call, the
vt
usually refers to a
VersionedTarget
-- see https://github.com/pantsbuild/pants/blob/b0d59b440a2e616eb7246325dc021bc186f758a5/src/python/pants/invalidation/cache_manager.py#L170
(just background info in case you weren't aware)
a

average-sugar-76469

01/14/2019, 10:32 PM
Yeah, you are probably correct. The code uses
vt
which I replaced with
virtual_target
, but
versioned_target
is likely the correct expansion.
a

aloof-angle-91616

01/14/2019, 10:35 PM
stu's response in the channel answers the main question though, which is that
vt.target.payload.fingerprint()
is just a cache key for the current target's payload, which may contain sources, etc. the cache key for the versioned target may be calculated based on dependencies or other things, again depending on the task. the cache key is what is specifically used for invalidation for
self.invalidated()
-- i think it can be considered a superset (meaning strictly more granular) than the target's
.fingerprint()
(which is calculated from the payload as you have above, usually -- this can be modified as well), but it again depends on the task.
5 Views