-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Optimized number of queries on GET /projects
, GET /project/<id>/preview
and GET /labels
endpoints.
#8155
Conversation
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes involve optimizing data processing in the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- cvat/apps/engine/serializers.py (1 hunks)
- cvat/apps/engine/views.py (3 hunks)
Additional comments not posted (6)
cvat/apps/engine/serializers.py (2)
1347-1348
: Good use of generators for memory efficiency!Using generators to collect
subsets
anddimensions
is a memory-efficient improvement.
1349-1352
: Ensure the first dimension is correctly retrievedThe use of
next(dimensions, None)
retrieves the first dimension orNone
if the generator is empty. Verify that this behavior is intended and correct.cvat/apps/engine/views.py (4)
292-293
: Ensure correctness of the filtering logic forpreview
action.The code changes are approved.
However, ensure that the filtering logic for the
preview
action is appropriate and efficient.
630-630
: Ensure correctness of the data fetching logic for the first task inpreview
method.The code changes are approved.
However, ensure that necessary related data is included and the method handles cases where no tasks are available.
869-870
: Ensure correctness of the filtering logic forpreview
action.The code changes are approved.
However, ensure that the filtering logic for the
preview
action is appropriate and efficient.
870-870
: Ensure correctness of the data fetching logic for the first task inpreview
method.The code changes are approved.
However, ensure that necessary related data is included and the method handles cases where no tasks are available.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #8155 +/- ##
==========================================
Coverage ? 83.31%
==========================================
Files ? 388
Lines ? 41354
Branches ? 3856
==========================================
Hits ? 34454
Misses ? 6900
Partials ? 0
|
/projects
, GET /project/<id>/preview
and GET /labels
endpoints.
cvat/apps/engine/views.py
Outdated
if self.action in ('list', 'retrieve', 'partial_update', 'update') : | ||
queryset = queryset.select_related( | ||
'annotation_guide', 'source_storage', 'target_storage', | ||
).prefetch_related('tasks') |
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.
How about export/import backup/dataset v1/v2? I remember that at least target_storage/source_storage is used when exporting/importing a project resource.
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.
I will check
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.
Added 'source_storage', 'target_storage' to the default queryset.
@Marishka17 |
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.
LGTM
Quality Gate passedIssues Measures |
Motivation and context
Retrieving a list of projects and previews:
Before:
After:
Retrieving a list of labels for a project O(number of labels) with 10 labels:
Before:
After:
How has this been tested?
Checklist
develop
branch(cvat-canvas,
cvat-core,
cvat-data and
cvat-ui)
License
Feel free to contact the maintainers if that's a concern.
Summary by CodeRabbit
New Features
Bug Fixes