Skip to content

Commit

Permalink
refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
munishchouhan committed May 5, 2024
1 parent 9061a5d commit 626825b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class KubeTransferStrategy implements TransferStrategy {
@Override
BlobCacheInfo transfer(BlobCacheInfo info, List<String> command) {
final name = getName(info)
final job = k8sService.transferJob(name, name, blobConfig.s5Image, command, blobConfig)
final job = k8sService.transferJob(name, blobConfig.s5Image, command, blobConfig)
final podList = k8sService.waitJob(job, blobConfig.transferTimeout.toMillis())
if ( !podList || podList.items.size() < 1 ) {
throw new TransferTimeoutException("Blob transfer job timeout")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ interface K8sService {

V1ContainerStateTerminated waitPod(V1Pod pod, long timeout)

V1Job transferJob(String name, String podName, String containerImage, List<String> args, BlobCacheConfig blobConfig)
V1Job transferJob(String name, String containerImage, List<String> args, BlobCacheConfig blobConfig)

V1PodList waitJob(V1Job job, Long timeout)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,15 +578,15 @@ class K8sServiceImpl implements K8sService {
}

@Override
V1Job transferJob(String name, String podName, String containerImage, List<String> args, BlobCacheConfig blobConfig) {
final spec = createTransferSpec(name, podName, containerImage, args, blobConfig)
V1Job transferJob(String name, String containerImage, List<String> args, BlobCacheConfig blobConfig) {
final spec = createTransferSpec(name, containerImage, args, blobConfig)

return k8sClient
.batchV1Api()
.createNamespacedJob(namespace, spec, null, null, null,null)
}

V1Job createTransferSpec(String name, String podName, String containerImage, List<String> args, BlobCacheConfig blobConfig) {
V1Job createTransferSpec(String name, String containerImage, List<String> args, BlobCacheConfig blobConfig) {

V1JobBuilder builder = new V1JobBuilder()

Expand All @@ -610,7 +610,7 @@ class K8sServiceImpl implements K8sService {
.withActiveDeadlineSeconds(blobConfig.transferTimeout.toSeconds())
.withRestartPolicy("Never")
.addNewContainer()
.withName(podName)
.withName(name)
.withImage(containerImage)
.withArgs(args)
.withResources(resources)
Expand Down

0 comments on commit 626825b

Please sign in to comment.