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

Fix job meta requests #7560

Merged
merged 9 commits into from
Mar 8, 2024
Merged

Fix job meta requests #7560

merged 9 commits into from
Mar 8, 2024

Conversation

klakhov
Copy link
Contributor

@klakhov klakhov commented Mar 6, 2024

Motivation and context

Pr fixes two problems:

  • PATCH /data/meta is sent every time the job is saved independently of changes in meta data
  • GET /data/meta is sent twice on job load

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • [ ] 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.

@klakhov klakhov requested a review from bsekachev as a code owner March 6, 2024 12:45
@bsekachev
Copy link
Member

@klakhov Could you please check tests?

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

Merging #7560 (bfab90c) into develop (5b9ab8e) will decrease coverage by 0.01%.
Report is 1 commits behind head on develop.
The diff coverage is 82.81%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7560      +/-   ##
===========================================
- Coverage    83.53%   83.52%   -0.01%     
===========================================
  Files          372      372              
  Lines        39661    39693      +32     
  Branches      3724     3729       +5     
===========================================
+ Hits         33130    33153      +23     
- Misses        6531     6540       +9     
Components Coverage Δ
cvat-ui 79.41% <82.81%> (-0.02%) ⬇️
cvat-server 87.31% <ø> (ø)

cvat-core/src/frames.ts Outdated Show resolved Hide resolved
cvat-core/src/frames.ts Outdated Show resolved Hide resolved
cvat-core/src/frames.ts Outdated Show resolved Hide resolved
cvat-core/src/frames.ts Outdated Show resolved Hide resolved
@@ -379,14 +414,31 @@ Object.defineProperty(FrameData.prototype.data, 'implementation', {
writable: false,
});

async function getJobMeta(jobID: number): Promise<FramesMetaData> {
let meta: FramesMetaData;
Copy link
Member

Choose a reason for hiding this comment

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

I can't see how in general it solves the problem of two parallel requests.
It solves in current case when requests are sent one by one.

The first from findFrame, the second from getFrame.
But if they are sent in parallel, it will not work.

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we need somehow memoize receiveJobMeta() function in order to return already existing promise for the second request (pending or resolved), but not rejected. If the first promise was rejected, probably it is better to resend the request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

cvat-core/src/frames.ts Outdated Show resolved Hide resolved
@@ -163,6 +163,7 @@ context('Manipulations with masks', { scrollBehavior: false }, () => {
describe('Tests to make sure that empty masks cannot be created', () => {
beforeEach(() => {
cy.removeAnnotations();
cy.saveJob('PUT');
Copy link
Member

Choose a reason for hiding this comment

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

Could you please clarify why it worked before?

Copy link
Contributor Author

@klakhov klakhov Mar 7, 2024

Choose a reason for hiding this comment

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

cy.saveJob('PATCH', 200, 'removeUnderlyingPixelsUndoRedo') lines inside Empty masks are deleted using remove underlying pixels feature case are depending on PATCH annotations requests. But after removeAnnotations, first update of the annotations is sent via PUT request.

So before the fix first call of the cy.saveJob('PATCH'... catched not the PATCH /annotations , but PATCH data/meta and worked well. After the fix PATCH data/meta is not sent, so the test failed.

We can either:

  1. Look for PUT request in first call of the cy.saveJob(... inside the test
  2. Save job after each remove annotations, so all saves inside test are looking for PATCH requests.
    Ive decided to go the second way.

@bsekachev bsekachev merged commit 2fe5490 into develop Mar 8, 2024
34 checks passed
@cvat-bot cvat-bot bot mentioned this pull request Mar 11, 2024
@bsekachev bsekachev deleted the kl/fix-meta-requests branch March 15, 2024 07:32
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.

2 participants