Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
fix: final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elijaharita committed Nov 10, 2023
1 parent 6229fca commit d6193a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion integration/singularity/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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
}
10 changes: 8 additions & 2 deletions integration/singularity/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit d6193a9

Please sign in to comment.