Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk select proposals/candidates exceeds API rate limit #170

Open
mzur opened this issue May 15, 2024 · 1 comment
Open

Bulk select proposals/candidates exceeds API rate limit #170

mzur opened this issue May 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mzur
Copy link
Member

mzur commented May 15, 2024

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).

@mzur mzur moved this to Medium Priority in BIIGLE Roadmap May 15, 2024
@mzur mzur added the bug Something isn't working label May 15, 2024
@mzur
Copy link
Member Author

mzur commented Jul 24, 2024

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:

  • Switch to the dev-modules branch of biigle/core.
  • Create a new volume.
  • Run 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,
    ]);
  • You can find the MAIA job listed on the page http://localhost:8000/volumes/15768/maia (again replace the volume ID). There you can also delete the job if you no longer need it or want to create a new one.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Medium Priority
Development

No branches or pull requests

2 participants