From 35a71e0b1391197cc8deb814f8143647768dee4d Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 30 Jul 2020 12:20:14 +0300 Subject: [PATCH 1/4] Added clearing a frame cache when close a task --- cvat-core/package.json | 2 +- cvat-core/src/frames.js | 8 ++++++++ cvat-core/src/session.js | 8 +++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cvat-core/package.json b/cvat-core/package.json index 5f7d2fcd6833..a34f53d06485 100644 --- a/cvat-core/package.json +++ b/cvat-core/package.json @@ -1,6 +1,6 @@ { "name": "cvat-core", - "version": "3.3.0", + "version": "3.3.1", "description": "Part of Computer Vision Tool which presents an interface for client-side integration", "main": "babel.config.js", "scripts": { diff --git a/cvat-core/src/frames.js b/cvat-core/src/frames.js index 66145a0689d2..0e95d42de4d7 100644 --- a/cvat-core/src/frames.js +++ b/cvat-core/src/frames.js @@ -605,10 +605,18 @@ }; } + function clear(taskID) { + if (taskID in frameDataCache) { + frameDataCache[taskID].frameBuffer.clear(); + delete frameDataCache[taskID]; + } + } + module.exports = { FrameData, getFrame, getRanges, getPreview, + clear, }; })(); diff --git a/cvat-core/src/session.js b/cvat-core/src/session.js index 5d5bd7b2e5b7..6a994e0a88c6 100644 --- a/cvat-core/src/session.js +++ b/cvat-core/src/session.js @@ -11,7 +11,12 @@ const PluginRegistry = require('./plugins'); const loggerStorage = require('./logger-storage'); const serverProxy = require('./server-proxy'); - const { getFrame, getRanges, getPreview } = require('./frames'); + const { + getFrame, + getRanges, + getPreview, + clear: clearFrames, + } = require('./frames'); const { ArgumentError } = require('./exceptions'); const { TaskStatus } = require('./enums'); const { Label } = require('./labels'); @@ -1593,6 +1598,7 @@ }; Task.prototype.close.implementation = function closeTask() { + clearFrames(this.id); for (const job of this.jobs) { closeSession(job); } From 5ac12b3045d93011455d151b8b7396387ff95857 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 30 Jul 2020 12:20:49 +0300 Subject: [PATCH 2/4] Show error when plugins could not be initialized --- cvat-ui/src/actions/plugins-actions.ts | 20 ++++++++++++++----- cvat-ui/src/reducers/interfaces.ts | 7 +++---- cvat-ui/src/reducers/notifications-reducer.ts | 20 +++++++++++++++++++ 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/cvat-ui/src/actions/plugins-actions.ts b/cvat-ui/src/actions/plugins-actions.ts index 21b3fed5e6f9..5d58a11f2b7e 100644 --- a/cvat-ui/src/actions/plugins-actions.ts +++ b/cvat-ui/src/actions/plugins-actions.ts @@ -8,7 +8,8 @@ import PluginChecker from 'utils/plugin-checker'; export enum PluginsActionTypes { CHECK_PLUGINS = 'CHECK_PLUGINS', - CHECKED_ALL_PLUGINS = 'CHECKED_ALL_PLUGINS' + CHECKED_ALL_PLUGINS = 'CHECKED_ALL_PLUGINS', + RAISE_PLUGIN_CHECK_ERROR = 'RAISE_PLUGIN_CHECK_ERROR' } type PluginObjects = Record; @@ -20,6 +21,11 @@ const pluginActions = { list, }) ), + raisePluginCheckError: (error: Error) => ( + createAction(PluginsActionTypes.RAISE_PLUGIN_CHECK_ERROR, { + error, + }) + ), }; export type PluginActions = ActionUnion; @@ -39,9 +45,13 @@ export function checkPluginsAsync(): ThunkAction { PluginChecker.check(SupportedPlugins.DEXTR_SEGMENTATION), ]; - const values = await Promise.all(promises); - [plugins.ANALYTICS, plugins.GIT_INTEGRATION, - plugins.DEXTR_SEGMENTATION] = values; - dispatch(pluginActions.checkedAllPlugins(plugins)); + try { + const values = await Promise.all(promises); + [plugins.ANALYTICS, plugins.GIT_INTEGRATION, + plugins.DEXTR_SEGMENTATION] = values; + dispatch(pluginActions.checkedAllPlugins(plugins)); + } catch (error) { + dispatch(pluginActions.raisePluginCheckError(error)); + } }; } diff --git a/cvat-ui/src/reducers/interfaces.ts b/cvat-ui/src/reducers/interfaces.ts index 065b0dd854e1..5e7961c79291 100644 --- a/cvat-ui/src/reducers/interfaces.ts +++ b/cvat-ui/src/reducers/interfaces.ts @@ -235,8 +235,9 @@ export interface NotificationsState { userAgreements: { fetching: null | ErrorState; }; - - [index: string]: any; + plugins: { + initializationError: null | ErrorState; + }; }; messages: { tasks: { @@ -245,8 +246,6 @@ export interface NotificationsState { models: { inferenceDone: string; }; - - [index: string]: any; }; } diff --git a/cvat-ui/src/reducers/notifications-reducer.ts b/cvat-ui/src/reducers/notifications-reducer.ts index 68a65ca54798..ee08de33b16f 100644 --- a/cvat-ui/src/reducers/notifications-reducer.ts +++ b/cvat-ui/src/reducers/notifications-reducer.ts @@ -15,9 +15,11 @@ import { AnnotationActionTypes } from 'actions/annotation-actions'; import { NotificationsActionType } from 'actions/notification-actions'; import { BoundariesActionTypes } from 'actions/boundaries-actions'; import { UserAgreementsActionTypes } from 'actions/useragreements-actions'; +import { PluginsActionTypes } from 'actions/plugins-actions'; import { NotificationsState } from './interfaces'; + const defaultState: NotificationsState = { errors: { auth: { @@ -84,6 +86,9 @@ const defaultState: NotificationsState = { userAgreements: { fetching: null, }, + plugins: { + initializationError: null, + }, }, messages: { tasks: { @@ -805,6 +810,21 @@ export default function (state = defaultState, action: AnyAction): Notifications }, }; } + case PluginsActionTypes.RAISE_PLUGIN_CHECK_ERROR: { + return { + ...state, + errors: { + ...state.errors, + plugins: { + ...state.errors.plugins, + initializationError: { + message: 'Could not initialize plugins state', + reason: action.payload.error.toString(), + }, + }, + }, + }; + } case NotificationsActionType.RESET_ERRORS: { return { ...state, From da0b9daa1912b65d5484a9f491675ffc320eec87 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 30 Jul 2020 12:21:08 +0300 Subject: [PATCH 3/4] Updated version of cvat-ui --- cvat-ui/package-lock.json | 2 +- cvat-ui/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 0ca9624a6ef2..0d7de93f6716 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.6.6", + "version": "1.6.7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 49a2bd37eb1f..b97d19fe0086 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.6.6", + "version": "1.6.7", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { From 1c4d88d544dbca83702ca80f5700a38a6c609716 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 30 Jul 2020 12:29:32 +0300 Subject: [PATCH 4/4] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c1fd2a7baec..e230af8bed80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Intelligent polygon editing () - Support creating multiple jobs for each task through python cli (https://github.com/opencv/cvat/pull/1950) - python cli over https () +- Error message when plugins weren't able to initialize instead of infinite loading () ### Changed - Smaller object details () @@ -42,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Interpolated shapes exported as `keyframe = True` () - Stylelint filetype scans () - Fixed toolip closing issue () +- Clearing frame cache when close a task () ### Security -