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

Remove collections in endpoints #5662

Merged
merged 176 commits into from
Feb 21, 2023

Conversation

zhiltsov-max
Copy link
Contributor

@zhiltsov-max zhiltsov-max commented Feb 2, 2023

Motivation and context

This PR is focused on server performance optimization for requests with collections.

  • Collections with user-controlled size are removed from server output and replaced
    with structures providing links to the matching paginated endpoints and summary info:
    • /api/projects/{id}.tasks -> /api/tasks?project_id={id}
    • /api/tasks/{id}.segments -> /api/jobs?task_id={id}: .start_frame, .stop_frame
    • /api/jobs/{id}.issues -> /api/issues?job_id={id}
    • /api/issues/{id}.comments -> /api/comments?issue_id={id}
    • /api/projects | tasks | jobs/{id}.labels -> /api/labels? project_id|task_id|job_id={id}
  • Added Label-related endpoints:
    • /api/labels (GET)
    • /api/labels/{id} (GET, PATCH, DELETE)
      • PATCH and DELETE both cannot be used for sublabels
  • Added and updated tests
    • Removed unused test server data
    • Added several new cases with skeletons and ownerships
  • Fixed possible problems with duplicate labels appearing on renaming

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have added a description of my changes into the CHANGELOG file
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@zhiltsov-max zhiltsov-max force-pushed the zm/remove-duplicating-collections-in-endpoints branch from 0136262 to 9f36ebb Compare February 20, 2023 18:44
try:
db_label.save()
except models.InvalidLabel as exc:
raise exceptions.ValidationError(str(exc)) from exc

Check warning

Code scanning / CodeQL

Information exposure through an exception

[Stack trace information](1) flows to this location and may be exposed to an external user.
@zhiltsov-max zhiltsov-max changed the title Remove collections in endpoints [WIP] Remove collections in endpoints Feb 21, 2023
@zhiltsov-max zhiltsov-max changed the title [WIP] Remove collections in endpoints Remove collections in endpoints Feb 21, 2023
cvat/apps/engine/views.py Outdated Show resolved Hide resolved
cvat/apps/engine/views.py Outdated Show resolved Hide resolved
fields = ('id', 'name', 'color', 'attributes', 'deleted', 'type', 'svg', 'sublabels', 'has_parent')
fields = (
'id', 'name', 'color', 'attributes', 'deleted', 'type', 'svg',
'sublabels', 'project_id', 'task_id', 'parent_id', 'has_parent'
Copy link
Contributor

@Marishka17 Marishka17 Feb 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed need to keep only one field has_parent or parent_id in the next PR (probably parent_id is more informative)

Co-authored-by: Maria Khrustaleva <maya17grd@gmail.com>
@nmanovic nmanovic merged commit 4fc494f into develop Feb 21, 2023
@nmanovic nmanovic deleted the zm/remove-duplicating-collections-in-endpoints branch February 21, 2023 15:23
@zhiltsov-max zhiltsov-max mentioned this pull request Feb 21, 2023
7 tasks
nmanovic pushed a commit that referenced this pull request Feb 21, 2023
Updates changelog after #5662
mikhail-treskin pushed a commit to retailnext/cvat that referenced this pull request Jul 1, 2023
This PR is focused on server performance optimization for requests with
collections.
- Collections with user-controlled size are removed from server output
and replaced
with structures providing links to the matching paginated endpoints and
summary info:
  - /api/projects/{id}.tasks -> /api/tasks?project_id={id}
- /api/tasks/{id}.segments -> /api/jobs?task_id={id}: .start_frame,
.stop_frame
  - /api/jobs/{id}.issues -> /api/issues?job_id={id}
  - /api/issues/{id}.comments -> /api/comments?issue_id={id}
- /api/projects | tasks | jobs/{id}.labels -> /api/labels?
project_id|task_id|job_id={id}
- Added Label-related endpoints:
  - /api/labels (GET)
  - /api/labels/{id} (GET, PATCH, DELETE)
    - PATCH and DELETE both cannot be used for sublabels
- Added and updated tests
  - Removed unused test server data
  - Added several new cases with skeletons and ownerships
- Fixed possible problems with duplicate labels appearing on renaming
mikhail-treskin pushed a commit to retailnext/cvat that referenced this pull request Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants