diff --git a/integration/singularity/cleanup.go b/integration/singularity/cleanup.go index 8ba97c7..80fd7b6 100644 --- a/integration/singularity/cleanup.go +++ b/integration/singularity/cleanup.go @@ -85,6 +85,8 @@ func (cs *cleanupScheduler) stop(ctx context.Context) error { } func (cs *cleanupScheduler) cleanup(ctx context.Context) error { + logger.Info("Starting cleanup") + ids, err := cs.local.List(ctx) if err != nil { return fmt.Errorf("failed to list local blob IDs: %w", err) @@ -94,7 +96,7 @@ func (cs *cleanupScheduler) cleanup(ctx context.Context) error { for _, id := range ids { cleanupReady, err := cs.cleanupReady(ctx, id) if err != nil { - logger.Warnf("failed to check if blob is ready for cleanup, skipping for this cleanup cycle: %w", err) + logger.Warnw("failed to check if blob is ready for cleanup, skipping for this cleanup cycle", "err", err) continue } if cleanupReady { @@ -106,5 +108,11 @@ func (cs *cleanupScheduler) cleanup(ctx context.Context) error { cs.local.Remove(ctx, blobID) } + if len(removals) > 0 { + logger.Infow("Cleaned up unneeded local files", "count", len(removals)) + } else { + logger.Info("Did not find any local files to clean up") + } + return nil } diff --git a/integration/singularity/store.go b/integration/singularity/store.go index 917b084..6314c26 100644 --- a/integration/singularity/store.go +++ b/integration/singularity/store.go @@ -323,6 +323,7 @@ func (s *Store) runPreparationJobs() { logger.Errorw("Failed to prepare to pack file", "fileID", fileID, "error", err) continue } + logger.Infow("Prepared file for packing", "fileID", fileID) if prepareToPackFileRes.Payload > s.packThreshold { if err := s.prepareToPackSource(ctx); err != nil { logger.Errorw("Failed to prepare to pack source", "error", err) @@ -552,9 +553,14 @@ func (s *Store) hasDealForAllProviders(ctx context.Context, blobID blob.ID) (boo // Make sure the file has at least 1 deal for every SP for _, sp := range s.storageProviders { - var foundDealForSP bool + foundDealForSP := false for _, deal := range getFileDealsRes.Payload { - if deal.Provider == sp.String() && (deal.State == models.ModelDealStatePublished || deal.State == models.ModelDealStateActive) { + // Only check state for current provider + if deal.Provider != sp.String() { + continue + } + + if deal.State == models.ModelDealStatePublished || deal.State == models.ModelDealStateActive { foundDealForSP = true break }