From 022f45d76522be28dfef3e91c2530bba57bfcb53 Mon Sep 17 00:00:00 2001 From: Kirill Lakhov Date: Wed, 4 Dec 2024 14:04:25 +0300 Subject: [PATCH] Update assets for chunk test (#8740) ### Motivation and context - Added a setting into cvat-core to manipulate `jobMetaDataReloadPeriod` ### How has this been tested? ### Checklist - [x] 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]( 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. ## 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. --------- Co-authored-by: Boris Sekachev --- cvat-core/src/api.ts | 6 ++++++ cvat-core/src/config.ts | 2 ++ cvat-core/src/frames.ts | 4 ++-- cvat-core/src/index.ts | 1 + tests/cypress/support/commands.js | 8 ++++++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cvat-core/src/api.ts b/cvat-core/src/api.ts index f4eb5d8b23fd..60de43fd4b18 100644 --- a/cvat-core/src/api.ts +++ b/cvat-core/src/api.ts @@ -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}`, diff --git a/cvat-core/src/config.ts b/cvat-core/src/config.ts index 99d76a723655..eefb535814bb 100644 --- a/cvat-core/src/config.ts +++ b/cvat-core/src/config.ts @@ -19,6 +19,8 @@ const config = { globalObjectsCounter: 0, requestsStatusDelay: null, + + jobMetaDataReloadPeriod: 1 * 60 * 60 * 1000, // 1 hour }; export default config; diff --git a/cvat-core/src/frames.ts b/cvat-core/src/frames.ts index e02b3e640a83..dfdd35684178 100644 --- a/cvat-core/src/frames.ts +++ b/cvat-core/src/frames.ts @@ -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 { 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 diff --git a/cvat-core/src/index.ts b/cvat-core/src/index.ts index 79ce8b305a9f..4eff35601f70 100644 --- a/cvat-core/src/index.ts +++ b/cvat-core/src/index.ts @@ -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; diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index f0f085260cbf..9941a9b0d5c3 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -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', () => {