Skip to content

Commit 400d108

Browse files
committed
Fix enable_caching issues when handling PVC creation/deletion
Signed-off-by: Ricardo M. Oliveira <rmartine@redhat.com>
1 parent 9ccec4c commit 400d108

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

backend/src/v2/driver/driver.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,9 +1793,11 @@ func createPVC(
17931793
return "", createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to get id from createdExecution")
17941794
}
17951795
*/
1796-
err = createCache(ctx, createdExecution, opts, taskStartedTime, fingerPrint, cacheClient)
1797-
if err != nil {
1798-
return "", createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to create cache entrty for create pvc: %w", err)
1796+
if opts.Task.GetCachingOptions().GetEnableCache() && ecfg.CachedMLMDExecutionID != "" {
1797+
err = createCache(ctx, createdExecution, opts, taskStartedTime, fingerPrint, cacheClient)
1798+
if err != nil {
1799+
return "", createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to create cache entry for create pvc: %w", err)
1800+
}
17991801
}
18001802

18011803
return createdPVC.ObjectMeta.Name, createdExecution, pb.Execution_COMPLETE, nil
@@ -1902,9 +1904,11 @@ func deletePVC(
19021904
return createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to get id from createdExecution")
19031905
}
19041906
*/
1905-
err = createCache(ctx, createdExecution, opts, taskStartedTime, fingerPrint, cacheClient)
1906-
if err != nil {
1907-
return createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to create cache entrty for delete pvc: %w", err)
1907+
if opts.Task.GetCachingOptions().GetEnableCache() && ecfg.CachedMLMDExecutionID != "" {
1908+
err = createCache(ctx, createdExecution, opts, taskStartedTime, fingerPrint, cacheClient)
1909+
if err != nil {
1910+
return createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to create cache entry for delete pvc: %w", err)
1911+
}
19081912
}
19091913

19101914
return createdExecution, pb.Execution_COMPLETE, nil

0 commit comments

Comments
 (0)