Skip to content

Commit

Permalink
Merge branch 'develop' into dk/label-deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Sekachev authored Mar 18, 2021
2 parents c38f3f7 + 5b46b51 commit e269d4a
Show file tree
Hide file tree
Showing 44 changed files with 2,656 additions and 94 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Pre-built [cvat_server](https://hub.docker.com/r/openvino/cvat_server) and
[cvat_ui](https://hub.docker.com/r/openvino/cvat_ui) images were published on DockerHub (<https://github.com/openvinotoolkit/cvat/pull/2766>)
- Project task subsets (<https://github.com/openvinotoolkit/cvat/pull/2774>)
- [VGGFace2](https://github.com/ox-vgg/vgg_face2) format support (<https://github.com/openvinotoolkit/cvat/pull/2865>)
- Kubernetes templates and guide for their deployment (<https://github.com/openvinotoolkit/cvat/pull/1962>)
- [WiderFace](http://shuoyang1213.me/WIDERFACE/) format support (<https://github.com/openvinotoolkit/cvat/pull/2864>)
- [VGGFace2](https://github.com/ox-vgg/vgg_face2) format support (<https://github.com/openvinotoolkit/cvat/pull/2865>)
- [Backup/Restore guide](cvat/apps/documentation/backup_guide.md) (<https://github.com/openvinotoolkit/cvat/pull/2964>)
- Label deletion from tasks and projects (<https://github.com/openvinotoolkit/cvat/pull/2881>)

### Changed
Expand Down Expand Up @@ -67,6 +69,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- An error about track shapes outside of the task frames during export (<https://github.com/openvinotoolkit/cvat/pull/2890>)
- Fixed project search field updating (<https://github.com/openvinotoolkit/cvat/pull/2901>)
- Fixed export error when invalid polygons are present in overlapping frames (<https://github.com/openvinotoolkit/cvat/pull/2852>)
- Fixed image quality option for tasks created from images (<https://github.com/openvinotoolkit/cvat/pull/2963>)
- Incorrect text on the warning when specifying an incorrect link to the issue tracker (<https://github.com/openvinotoolkit/cvat/pull/2971>)
- Updating label attributes when label contains number attributes (<https://github.com/openvinotoolkit/cvat/pull/2969>)

### Security

Expand Down
6 changes: 3 additions & 3 deletions cvat-data/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"worker-loader": "^2.0.0"
},
"dependencies": {
"async-mutex": "^0.3.0",
"async-mutex": "^0.3.1",
"jszip": "3.6.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.15.3",
"version": "1.15.5",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
15 changes: 9 additions & 6 deletions cvat-ui/src/components/create-task-page/create-task-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import Button from 'antd/lib/button';
import Collapse from 'antd/lib/collapse';
import notification from 'antd/lib/notification';
import Text from 'antd/lib/typography/Text';
// eslint-disable-next-line import/no-extraneous-dependencies
import { ValidateErrorEntity } from 'rc-field-form/lib/interface';

import ConnectedFileManager from 'containers/file-manager/file-manager';
import LabelsEditor from 'components/labels-editor/labels-editor';
Expand Down Expand Up @@ -183,19 +185,20 @@ class CreateTaskContent extends React.PureComponent<Props & RouteComponentProps,
if (this.advancedConfigurationComponent.current) {
return this.advancedConfigurationComponent.current.submit();
}

return new Promise<void>((resolve): void => {
resolve();
});
return Promise.resolve();
})
.then((): void => {
const { onCreate } = this.props;
onCreate(this.state);
})
.catch((error: Error): void => {
.catch((error: Error | ValidateErrorEntity): void => {
notification.error({
message: 'Could not create a task',
description: error.toString(),
description: (error as ValidateErrorEntity).errorFields ?
(error as ValidateErrorEntity).errorFields
.map((field) => `${field.name} : ${field.errors.join(';')}`)
.map((text: string): JSX.Element => <div>{text}</div>) :
error.toString(),
className: 'cvat-notification-create-task-fail',
});
});
Expand Down
30 changes: 17 additions & 13 deletions cvat-ui/src/components/labels-editor/label-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,20 @@ export default class LabelForm extends React.Component<Props> {
const locked = attr ? attr.id >= 0 : false;
const existedValues = attr ? attr.values : [];

const validator = (_: any, values: string[], callback: any): void => {
const validator = (_: any, values: string[]): Promise<void> => {
if (locked && existedValues) {
if (!equalArrayHead(existedValues, values)) {
callback('You can only append new values');
return Promise.reject(new Error('You can only append new values'));
}
}

for (const value of values) {
if (!patterns.validateAttributeValue.pattern.test(value)) {
callback(`Invalid attribute value: "${value}"`);
return Promise.reject(new Error(`Invalid attribute value: "${value}"`));
}
}

callback();
return Promise.resolve();
};

return (
Expand Down Expand Up @@ -223,35 +223,35 @@ export default class LabelForm extends React.Component<Props> {
private renderNumberRangeInput(fieldInstance: any, attr: Attribute | null): JSX.Element {
const { key } = fieldInstance;
const locked = attr ? attr.id >= 0 : false;
const value = attr ? attr.values.join(';') : '';
const value = attr ? attr.values : '';

const validator = (_: any, strNumbers: string, callback: any): void => {
const validator = (_: any, strNumbers: string): Promise<void> => {
const numbers = strNumbers.split(';').map((number): number => Number.parseFloat(number));
if (numbers.length !== 3) {
callback('Three numbers are expected');
return Promise.reject(new Error('Three numbers are expected'));
}

for (const number of numbers) {
if (Number.isNaN(number)) {
callback(`"${number}" is not a number`);
return Promise.reject(new Error(`"${number}" is not a number`));
}
}

const [min, max, step] = numbers;

if (min >= max) {
callback('Minimum must be less than maximum');
return Promise.reject(new Error('Minimum must be less than maximum'));
}

if (max - min < step) {
callback('Step must be less than minmax difference');
return Promise.reject(new Error('Step must be less than minmax difference'));
}

if (step <= 0) {
callback('Step must be a positive number');
return Promise.reject(new Error('Step must be a positive number'));
}

callback();
return Promise.resolve();
};

return (
Expand Down Expand Up @@ -339,7 +339,7 @@ export default class LabelForm extends React.Component<Props> {
{() => (
<Row
justify='space-between'
align='middle'
align='top'
cvat-attribute-id={fieldValue.id}
className='cvat-attribute-inputs-wrapper'
>
Expand Down Expand Up @@ -507,6 +507,10 @@ export default class LabelForm extends React.Component<Props> {
label.attributes.map(
(attribute: Attribute): Store => ({
...attribute,
values:
attribute.input_type.toUpperCase() === 'NUMBER' ?
attribute.values.join(';') :
attribute.values,
type: attribute.input_type.toUpperCase(),
}),
) :
Expand Down
7 changes: 5 additions & 2 deletions cvat-ui/src/components/task-page/bug-tracker-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020-2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -34,6 +34,7 @@ export default function BugTrackerEditorComponent(props: Props): JSX.Element {
onOk: () => {
shown = false;
},
className: 'cvat-modal-issue-tracker-update-task-fail',
});
shown = true;
}
Expand All @@ -52,7 +53,9 @@ export default function BugTrackerEditorComponent(props: Props): JSX.Element {
Issue Tracker
</Text>
<br />
<Text editable={{ onChange: onChangeValue }}>{bugTracker}</Text>
<Text editable={{ onChange: onChangeValue }} className='cvat-issue-tracker-value'>
{bugTracker}
</Text>
<Button
type='ghost'
size='small'
Expand Down
76 changes: 76 additions & 0 deletions cvat/apps/documentation/backup_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
## About CVAT data volumes

Docker volumes are used to store all CVAT data:

- `cvat_db`: PostgreSQL database files, used to store information about users, tasks, projects, annotations, etc.
Mounted into `cvat_db` container by `/var/lib/postgresql/data` path.

- `cvat_data`: used to store uploaded and prepared media data.
Mounted into `cvat` container by `/home/django/data` path.

- `cvat_keys`: used to store user ssh keys needed for [synchronization with a remote Git repository](user_guide.md#task-synchronization-with-a-repository).
Mounted into `cvat` container by `/home/django/keys` path.

- `cvat_logs`: used to store logs of CVAT backend processes managed by supevisord.
Mounted into `cvat` container by `/home/django/logs` path.

- `cvat_events`: this is an optional volume that is used only when [Analytics component](../../../components/analytics)
is enabled and is used to store Elasticsearch database files.
Mounted into `cvat_elasticsearch` container by `/usr/share/elasticsearch/data` path.

## How to backup all CVAT data

All CVAT containers should be stopped before backup:

```console
docker-compose stop
```

Please don't forget to include all the compose config files that were used in the docker-compose command
using the `-f` parameter.

Backup data:

```console
mkdir backup
docker run --rm --name temp_backup --volumes-from cvat_db -v $(pwd)/backup:/backup ubuntu tar -cjvf /backup/cvat_db.tar.bz2 /var/lib/postgresql/data
docker run --rm --name temp_backup --volumes-from cvat -v $(pwd)/backup:/backup ubuntu tar -cjvf /backup/cvat_data.tar.bz2 /home/django/data
# [optional]
docker run --rm --name temp_backup --volumes-from cvat_elasticsearch -v $(pwd)/backup:/backup ubuntu tar -cjvf /backup/cvat_events.tar.bz2 /usr/share/elasticsearch/data
```

Make sure the backup archives have been created, the output of `ls backup` command should look like this:

```console
ls backup
cvat_data.tar.bz2 cvat_db.tar.bz2 cvat_events.tar.bz2
```

## How to restore CVAT from backup

Note: CVAT containers must exist (if no, please follow the [installation guide](installation.md#quick-installation-guide)).
Stop all CVAT containers:

```console
docker-compose stop
```

Restore data:

```console
cd <path_to_backup_folder>
docker run --rm --name temp_backup --volumes-from cvat_db -v $(pwd):/backup ubuntu bash -c "cd /var/lib/postgresql/data && tar -xvf /backup/cvat_db.tar.bz2 --strip 4"
docker run --rm --name temp_backup --volumes-from cvat -v $(pwd):/backup ubuntu bash -c "cd /home/django/data && tar -xvf /backup/cvat_data.tar.bz2 --strip 3"
# [optional]
docker run --rm --name temp_backup --volumes-from cvat_elasticsearch -v $(pwd):/backup ubuntu bash -c "cd /usr/share/elasticsearch/data && tar -xvf /backup/cvat_events.tar.bz2 --strip 4"
```

After that run CVAT as usual:

```console
docker-compose up -d
```

## Additional resources

[Docker guide about volume backups](https://docs.docker.com/storage/volumes/#backup-restore-or-migrate-data-volumes)
7 changes: 5 additions & 2 deletions cvat/apps/documentation/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
- [How to upload annotations to an entire task from UI when there are multiple jobs in the task](#how-to-upload-annotations-to-an-entire-task-from-ui-when-there-are-multiple-jobs-in-the-task)
- [How to specify multiple hostnames for CVAT_HOST](#how-to-specify-multiple-hostnames-for-cvat_host)
- [How to create a task with multiple jobs](#how-to-create-a-task-with-multiple-jobs)
- [How to transfer CVAT to another machine](#how-to-transfer-cvat-to-another-machine)


## How to update CVAT

Before upgrading, please follow the official docker
[manual](https://docs.docker.com/storage/volumes/#backup-restore-or-migrate-data-volumes) and backup all CVAT volumes.
Before upgrading, please follow the [backup guide](backup_guide.md) and backup all CVAT volumes.

To update CVAT, you should clone or download the new version of CVAT and rebuild the CVAT docker images as usual.

Expand Down Expand Up @@ -149,3 +149,6 @@ services:

Set the segment size when you create a new task, this option is available in the
[Advanced configuration](user_guide.md#advanced-configuration) section.

## How to transfer CVAT to another machine
Follow the [backup/restore guide](backup_guide.md#how-to-backup-all-cvat-data).
Loading

0 comments on commit e269d4a

Please sign in to comment.