Skip to content

Commit

Permalink
Fix enable_caching issues when handling PVC creation/deletion
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo M. Oliveira <rmartine@redhat.com>
  • Loading branch information
rimolive committed Nov 27, 2024
1 parent 9ccec4c commit 5c5d99a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions backend/src/v2/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1793,9 +1793,11 @@ func createPVC(
return "", createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to get id from createdExecution")
}
*/
err = createCache(ctx, createdExecution, opts, taskStartedTime, fingerPrint, cacheClient)
if err != nil {
return "", createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to create cache entrty for create pvc: %w", err)
if opts.Task.GetCachingOptions().GetEnableCache() {
err = createCache(ctx, createdExecution, opts, taskStartedTime, fingerPrint, cacheClient)
if err != nil {
return "", createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to create cache entry for create pvc: %w", err)
}
}

return createdPVC.ObjectMeta.Name, createdExecution, pb.Execution_COMPLETE, nil
Expand Down Expand Up @@ -1902,9 +1904,11 @@ func deletePVC(
return createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to get id from createdExecution")
}
*/
err = createCache(ctx, createdExecution, opts, taskStartedTime, fingerPrint, cacheClient)
if err != nil {
return createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to create cache entrty for delete pvc: %w", err)
if opts.Task.GetCachingOptions().GetEnableCache() && ecfg.CachedMLMDExecutionID != "" {
err = createCache(ctx, createdExecution, opts, taskStartedTime, fingerPrint, cacheClient)
if err != nil {
return createdExecution, pb.Execution_FAILED, fmt.Errorf("failed to create cache entry for delete pvc: %w", err)
}
}

return createdExecution, pb.Execution_COMPLETE, nil
Expand Down

0 comments on commit 5c5d99a

Please sign in to comment.