Skip to content

Commit

Permalink
Update assets for chunk test (#8740)
Browse files Browse the repository at this point in the history
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->
- Added a setting into cvat-core to manipulate `jobMetaDataReloadPeriod`

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- ~~[ ] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->~~
- ~~[ ] I have updated the documentation accordingly~~
- ~~[ ] I have added tests to cover my changes~~
- ~~[ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))~~
- ~~[ ] I have increased versions of npm packages if it is necessary

([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),

[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and

[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))~~

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced a new configuration option for managing the job metadata
reload period, allowing users to set it dynamically.
	- The default reload period is set to one hour.

- **Improvements**
- Enhanced the logic for checking frame metadata freshness by using the
new dynamic reload period instead of a fixed constant.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Boris Sekachev <boris.sekachev@yandex.ru>
  • Loading branch information
klakhov and bsekachev authored Dec 4, 2024
1 parent 7d9c368 commit 022f45d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions cvat-core/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ function build(): CVATCore {
set requestsStatusDelay(value) {
config.requestsStatusDelay = value;
},
get jobMetaDataReloadPeriod() {
return config.jobMetaDataReloadPeriod;
},
set jobMetaDataReloadPeriod(value) {
config.jobMetaDataReloadPeriod = value;
},
},
client: {
version: `${pjson.version}`,
Expand Down
2 changes: 2 additions & 0 deletions cvat-core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const config = {
globalObjectsCounter: 0,

requestsStatusDelay: null,

jobMetaDataReloadPeriod: 1 * 60 * 60 * 1000, // 1 hour
};

export default config;
4 changes: 2 additions & 2 deletions cvat-core/src/frames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import serverProxy from './server-proxy';
import { SerializedFramesMetaData } from './server-response-types';
import { Exception, ArgumentError, DataError } from './exceptions';
import { FieldUpdateTrigger } from './common';
import config from './config';

// frame storage by job id
const frameDataCache: Record<string, {
Expand Down Expand Up @@ -597,8 +598,7 @@ async function refreshJobCacheIfOutdated(jobID: number): Promise<void> {
throw new Error('Frame data cache is abscent');
}

const META_DATA_RELOAD_PERIOD = 1 * 60 * 60 * 1000; // 1 hour
const isOutdated = (Date.now() - cached.metaFetchedTimestamp) > META_DATA_RELOAD_PERIOD;
const isOutdated = (Date.now() - cached.metaFetchedTimestamp) > config.jobMetaDataReloadPeriod;

if (isOutdated) {
// get metadata again if outdated
Expand Down
1 change: 1 addition & 0 deletions cvat-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export default interface CVATCore {
onOrganizationChange: (newOrgId: number | null) => void | null;
globalObjectsCounter: typeof config.globalObjectsCounter;
requestsStatusDelay: typeof config.requestsStatusDelay;
jobMetaDataReloadPeriod: typeof config.jobMetaDataReloadPeriod;
},
client: {
version: string;
Expand Down
8 changes: 8 additions & 0 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,14 @@ Cypress.Commands.add('configureTaskQualityMode', (qualityConfigurationParams) =>
cy.contains(qualityConfigurationParams.validationMode).click();
});
}
if (qualityConfigurationParams.validationFramesPercent) {
cy.get('#validationFramesPercent').clear();
cy.get('#validationFramesPercent').type(qualityConfigurationParams.validationFramesPercent);
}
if (qualityConfigurationParams.validationFramesPerJobPercent) {
cy.get('#validationFramesPerJobPercent').clear();
cy.get('#validationFramesPerJobPercent').type(qualityConfigurationParams.validationFramesPerJobPercent);
}
});

Cypress.Commands.add('removeAnnotations', () => {
Expand Down

0 comments on commit 022f45d

Please sign in to comment.