Skip to content

Commit

Permalink
Merge pull request #129 from biigle/patch-1
Browse files Browse the repository at this point in the history
Fix generate missing chunking
  • Loading branch information
mzur authored Jan 26, 2024
2 parents 8b89640 + 2ff6552 commit b81958c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Console/Commands/GenerateMissing.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected function handleImageAnnotations(): void
});

$this->line("Image annotations");
$this->handleAnnotations($annotations);
$this->handleAnnotations($annotations, 'image_annotations.id');
}

/**
Expand Down Expand Up @@ -151,10 +151,10 @@ protected function handleVideoAnnotations(): void
});

$this->line("Video annotations");
$this->handleAnnotations($annotations);
$this->handleAnnotations($annotations, 'video_annotations.id');
}

protected function handleAnnotations(Builder $annotations): void
protected function handleAnnotations(Builder $annotations, string $idColumn): void
{
$pushToQueue = !$this->option('dry-run');
$storage = Storage::disk(config('largo.patch_storage_disk'));
Expand All @@ -171,7 +171,8 @@ protected function handleAnnotations(Builder $annotations): void
$chunkSize = (int) $this->option('chunk-size', 10000);

// lazyById() is crucial as we can't load all annotations at once!
foreach ($annotations->with('file')->lazyById($chunkSize) as $annotation) {
$generator = $annotations->with('file')->lazyById($chunkSize, $idColumn);
foreach ($generator as $annotation) {
$progress->advance();

if ($this->skipPatches) {
Expand Down

0 comments on commit b81958c

Please sign in to comment.