Skip to content

Commit

Permalink
Add delete after finish to blob cache jobs (#576)
Browse files Browse the repository at this point in the history

Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Co-authored-by: munishchouhan <[email protected]>
  • Loading branch information
pditommaso and munishchouhan authored Jul 25, 2024
1 parent 7cf0b75 commit 2ef034c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ class BlobCacheConfig {
@Value('${wave.blobCache.retryAttempts:3}')
Integer retryAttempts

@Value('${wave.blobCache.deleteAfterFinished:7d}')
Duration deleteAfterFinished

@Value('${wave.blobCache.k8s.pod.delete.timeout:20s}')
Duration podDeleteTimeout

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class BlobCacheServiceImpl implements BlobCacheService {

static BlobCacheInfo awaitCompletion(BlobStore store, String key, BlobCacheInfo current) {
final beg = System.currentTimeMillis()
// set the await timeout nealy double as the blob transfer timeout, this because the
// set the await timeout nearly double as the blob transfer timeout, this because the
// transfer pod can spend `timeout` time in pending status awaiting to be scheduled
// and the same `timeout` time amount carrying out the transfer (upload) operation
final max = (store.timeout.toMillis() * 2.10) as long
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ class K8sServiceImpl implements K8sService {
//spec section
def spec = builder.withNewSpec()
.withBackoffLimit(blobConfig.retryAttempts)
.withTtlSecondsAfterFinished(blobConfig.deleteAfterFinished.toSeconds() as Integer)
.withNewTemplate()
.editOrNewSpec()
.withServiceAccount(serviceAccount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ class K8sServiceImplTest extends Specification {
getTransferTimeout() >> Duration.ofSeconds(20)
getEnvironment() >> [:]
getRetryAttempts() >> 5
getDeleteAfterFinished() >> Duration.ofDays(10)
}

when:
Expand All @@ -521,6 +522,7 @@ class K8sServiceImplTest extends Specification {
result.metadata.namespace == 'my-ns'
and:
result.spec.backoffLimit == 5
result.spec.ttlSecondsAfterFinished == Duration.ofDays(10).seconds as Integer
and:
verifyAll(result.spec.template.spec) {
activeDeadlineSeconds == 20
Expand Down Expand Up @@ -551,6 +553,7 @@ class K8sServiceImplTest extends Specification {
getRequestsCpu() >> '2'
getRequestsMemory() >> '8Gi'
getRetryAttempts() >> 3
getDeleteAfterFinished() >> Duration.ofDays(1)
}

when:
Expand All @@ -560,6 +563,7 @@ class K8sServiceImplTest extends Specification {
result.metadata.namespace == 'my-ns'
and:
result.spec.backoffLimit == 3
result.spec.ttlSecondsAfterFinished == Duration.ofDays(1).seconds as Integer
and:
verifyAll(result.spec.template.spec) {
activeDeadlineSeconds == 20
Expand Down

0 comments on commit 2ef034c

Please sign in to comment.