-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat: FIT-720: Avoid loading all annotations in LabelStream when the user is admin and goes to previous tasks #9276
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
Conversation
…user is admin and goes to previous tasks
✅ Deploy Preview for label-studio-docs-new-theme canceled.
|
✅ Deploy Preview for label-studio-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for heartex-docs canceled.
|
✅ Deploy Preview for label-studio-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #9276 +/- ##
===========================================
+ Coverage 65.17% 65.50% +0.32%
===========================================
Files 846 814 -32
Lines 65894 65552 -342
Branches 11483 11221 -262
===========================================
- Hits 42945 42937 -8
+ Misses 22945 22615 -330
+ Partials 4 0 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| const annotationIndex = this.task.annotations.findIndex((a) => String(a.id) === String(annotationPk)); | ||
| if (annotationIndex !== -1) { | ||
| // Merge full annotation data, removing stub flag | ||
| this.task.annotations[annotationIndex] = { | ||
| ...this.task.annotations[annotationIndex], | ||
| ...fullAnnotation, | ||
| is_stub: false, | ||
| }; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this throw mobxstatetree warnings/errors for the inline mutation without an explicit model action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so far it hasn't - but im making sure to keep an eye on that
bmartel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good, take another pass through the logic in LSE and LSO to check if we ever use the annotations in the "full" state. One thing that comes to mind is the compare all/summary. That would definitely use all data from the full annotations.
|
/fmt |
…labs/label-studio into fb-fit-720/lazy-load-annotations
… on its way to working with hydration properly
|
I'll split this PR up into multiple branches/PR to simplify delivery |
This pull request introduces a feature to improve performance when loading tasks with many annotations by implementing lazy loading for annotation data (FIT-720). When the relevant feature flag is enabled, only lightweight annotation stubs (excluding heavy fields like
result) are returned in task lists, and the full annotation data is fetched only when needed (e.g., when an annotation is selected). The backend and frontend are both updated to support this, and comprehensive tests are added to ensure correct behavior.Backend changes for lazy annotation loading:
AnnotationStubSerializerintasks/serializers.pyto provide lightweight annotation stubs, excluding heavy fields and including anis_stubflag for frontend identification.DataManagerTaskSerializerindata_manager/serializers.pyto use a newget_annotationsmethod that returns stubs or full annotations based on the feature flag and context. [1] [2]tasks/api.pyto passannotations_stubaccording to the feature flag and query parameter.Frontend changes for lazy annotation loading:
FF_FIT_720_LAZY_LOAD_ANNOTATIONStofeature-flags/flags.tsand propagated its use throughout the frontend codebase. [1] [2] [3]tasks.jsto request annotation stubs when the feature flag is enabled, and added aloadAnnotationmethod for fetching full annotation data by ID. [1] [2]lsf-sdk.jsto check for stub annotations and fetch full data from the backend when needed, updating both the task data and the annotation state in the UI. All relevant LSF initialization flows now support async annotation loading. [1] [2] [3] [4] [5]fetchAnnotation) for lazy loading.Testing and validation:
test_lazy_load_annotations.pyto verify that stub annotations are returned when the feature flag and query parameter are set, that full data is returned otherwise, and that single annotation endpoints always return full data.