Open mzur opened 5 months ago
Training proposals are updated (one at a time) here, annotation candidates here. The respective API endpoints are here and here. The tests can be found here and here.
For local development without a configured GPU for MAIA jobs, a fake MAIA job can be created manually as follows:
dev-modules
branch of biigle/core.docker compose run --rm -itu0 worker php artisan tinker
to enter the application console.Create a MAIA job where training proposals are selectable (replace the volume ID):
$volume = Volume::find(15768);
$j = Biigle\Modules\Maia\MaiaJob::factory()->create([
'volume_id' => $volume->id,
'state_id' => Biigle\Modules\Maia\MaiaJobState::trainingProposalsId(),
]);
$p = Biigle\Modules\Maia\TrainingProposal::factory()->count(5)->create([
'job_id' => $j->id,
'image_id' => $volume->images->first()->id,
]);
Alternatively, create a MAIA job where the annotation candidates are selectable:
$volume = Volume::find(15768);
$j = Biigle\Modules\Maia\MaiaJob::factory()->create([
'volume_id' => $volume->id,
'state_id' => Biigle\Modules\Maia\MaiaJobState::annotationCandidatesId(),
]);
$p = Biigle\Modules\Maia\TrainingProposal::factory()->count(5)->create([
'job_id' => $j->id,
'image_id' => $volume->images->first()->id,
'selected' => true,
]);
$a = Biigle\Modules\Maia\AnnotationCandidate::factory()->count(5)->create([
'job_id' => $j->id,
'image_id' => $volume->images->first()->id,
]);
The training proposals and annotation candidates won't have actual thumbnails with the faked data but they can be (bulk) selected, which is enough for this issue.
If a user uses the Shift+Click feature to bulk-select proposals/candidates, they can easily exceed the API rate limit because each proposal/candidate is updated with a separate request.
To fix this, update the proposal/candidate API endpoints to accept a list of up to 100 updated proposals/candidates (similar to the annotation bulk API endpoint). In the frontend, the single change then sends a request with a single list item. A bulk-select action, however, now sends bulk requests, too (splitting the actual number of changed proposals/candidates into chunks of 100).