Skip to content

Commit

Permalink
fix(backend): Caching - Make the cache key depend on output names and…
Browse files Browse the repository at this point in the history
… paths (#4675)

* Caching - Make the cache key depend on output names and paths

Output artifact/parameter names and paths are important and need to be considered.

* Fixed the test
  • Loading branch information
Ark-kun authored Mar 23, 2021
1 parent c36efb2 commit 5fbf224
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions backend/src/cache/server/mutation.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func generateCacheKeyFromTemplate(template string) (string, error) {
"volumeMounts": nil,
},
"inputs": nil,
"outputs": nil, // Output artifact/parameter names and paths are important and need to be considered. We can include the whole section since Argo does not seem to put the artifact s3 specifications here, leaving them in archiveLocation.
"volumes": nil,
"initContainers": nil,
"sidecars": nil,
Expand Down
4 changes: 2 additions & 2 deletions backend/src/cache/server/mutation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ func TestSetImage(t *testing.T) {

func TestMutatePodIfCachedWithTeamplateCleanup(t *testing.T) {
executionCache := &model.ExecutionCache{
ExecutionCacheKey: "f5fe913be7a4516ebfe1b5de29bcb35edd12ecc776b2f33f10ca19709ea3b2f0",
ExecutionCacheKey: "5a20e3f2e74863b363291953082d9812a58e25f7117bface1c76d40ef0ee88fc",
ExecutionOutput: "testOutput",
ExecutionTemplate: `Cache key was calculated from this: {"container":{"command":["echo", "Hello"],"image":"python:3.7"}}`,
ExecutionTemplate: `Cache key was calculated from this: {"container":{"command":["echo", "Hello"],"image":"python:3.7"},"outputs":"anything"}`,
MaxCacheStaleness: -1,
}
fakeClientManager.CacheStore().CreateExecutionCache(executionCache)
Expand Down

0 comments on commit 5fbf224

Please sign in to comment.