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

Az/import export tasks #3056

Merged
merged 29 commits into from
Jun 8, 2021
Merged

Az/import export tasks #3056

merged 29 commits into from
Jun 8, 2021

Conversation

azhavoro
Copy link
Contributor

@azhavoro azhavoro commented Apr 2, 2021

Motivation and context

How has this been tested?

Checklist

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.
  • I have updated the license header for each file (see an example below)
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT

@coveralls
Copy link

coveralls commented Apr 2, 2021

Coverage Status

Coverage decreased (-0.1%) to 73.963% when pulling 11a8bc9 on az/import_export_tasks into e45018b on develop.

cvat-core/src/server-proxy.js Outdated Show resolved Hide resolved
cvat-ui/src/actions/tasks-actions.ts Outdated Show resolved Hide resolved
cvat-ui/src/actions/tasks-actions.ts Outdated Show resolved Hide resolved
cvat-ui/src/actions/tasks-actions.ts Outdated Show resolved Hide resolved
cvat-ui/src/actions/tasks-actions.ts Outdated Show resolved Hide resolved
cvat-ui/src/reducers/tasks-reducer.ts Outdated Show resolved Hide resolved
cvat-ui/src/reducers/tasks-reducer.ts Show resolved Hide resolved
cvat-ui/src/reducers/tasks-reducer.ts Show resolved Hide resolved
cvat-ui/src/reducers/tasks-reducer.ts Outdated Show resolved Hide resolved
cvat-ui/src/components/actions-menu/actions-menu.tsx Outdated Show resolved Hide resolved
@bsekachev
Copy link
Member

bsekachev commented Apr 7, 2021

Tried this patch also. Some found issues:

  • Shifted layout for top bar. Also need to add space between Import and create.
    Screenshot from 2021-04-07 10-29-32

  • Since import can be long procedure, probably we need to add a notification popup with offer to open imported task (as in case with created tasks)

  • Unable to open imported video/3d task.

Error during fetching a job
TypeError: Reduce of empty array with no initial value
  • 3D task importing issue: The task was imported, but rq_default failed.
  • If I provide a wrong archive (for example with annotations), no any error messages on UI and rq_default also failed
  • Cannot dump annotation/export as a dataset for imported task:
Could not dump annotations for the task 50
Error: Request failed with status code 500. "ValueError: Unknown frame 0\n".

@azhavoro azhavoro changed the title [WIP] Az/import export tasks Az/import export tasks Apr 9, 2021
@nmanovic
Copy link
Contributor

@azhavoro , can we avoid limits 500 images, if we import a task? Does it handle properly?

@nmanovic
Copy link
Contributor

@azhavoro , when are we going to support the same functionality for projects?

dispatch(exportTaskFailed(taskInstance.id, error));
}

dispatch(exportTaskSuccess(taskInstance.id));
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably you can put the line under try. It looks more naturally.

help='output file'
)
export_task_parser.add_argument(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need the argument. Let's have something by default.

)
import_task_parser.add_argument(
'--import_verification_period',
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need the argument. Let's have something by default.

""" Export and download a whole task """
url = self.api.tasks_id(task_id)
export_url = url + '?action=export'
response = self.session.get(export_url)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like exactly the lines are in the beginning of while loop. Move sleep at the end of while and you can remove these 2 lines.

cvat/apps/engine/views.py Outdated Show resolved Hide resolved
from .log import slogger
from cvat.apps.engine import models
from cvat.apps.engine.log import slogger
from cvat.apps.engine.media_extractors import (MEDIA_TYPES, Mpeg4ChunkWriter,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert this changes? The indent should be 4 spaces.

@@ -284,6 +284,7 @@ Go to the [Django administration panel](http://localhost:8080/admin). There you
1. Assigned to — is used to assign a task to a person. Start typing an assignee’s name and/or
choose the right person out of the dropdown list.
- `Jobs` — is a list of all jobs for a particular task. Here you can find the next data:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you want to revert the file. Otherwise it will affect documentation PR.

@@ -536,14 +536,13 @@ archive.zip/
- `score` (number) - the annotation `score` field
- arbitrary attributes - will be stored in the `attributes` annotation section


*Note*: there is also a [support for COCO keypoints over Datumaro](https://github.com/openvinotoolkit/cvat/issues/2910#issuecomment-726077582)
Copy link
Contributor

Choose a reason for hiding this comment

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

OK. Probably it is a good idea to revert all files which you don't want to change.

async function importTask(file) {
const { backendAPI } = config;

let annotationData = new FormData();
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason behind annotationData name? Should it be payload or something like that?

Copy link
Contributor

@Marishka17 Marishka17 left a comment

Choose a reason for hiding this comment

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

Maybe need to update utils/cli/README.md

cvat/apps/engine/task.py Outdated Show resolved Hide resolved
cvat/apps/engine/backup.py Outdated Show resolved Hide resolved
url = self.api.tasks + '?action=import'
response = self.session.post(
url,
files={'task_file': open(filename, 'rb')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a handler if such file not exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

little bit improved, in this case error message will be like this, I think it's enough for user

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/343.zip'

@nmanovic
Copy link
Contributor

@azhavoro , I have found an issue. Multiple times to import the same video task and got the following error a couple of times:

2021-05-14 13:00:16,244 DEBG 'runserver' stderr output:
[Fri May 14 13:00:16.243927 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430] [2021-05-14 13:00:16,243] ERROR django.request: Internal Server Error: /api/v1/tasks
[Fri May 14 13:00:16.243959 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430] Traceback (most recent call last):
[Fri May 14 13:00:16.243966 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
[Fri May 14 13:00:16.243972 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     response = get_response(request)
[Fri May 14 13:00:16.243977 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
[Fri May 14 13:00:16.243983 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Fri May 14 13:00:16.243989 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
[Fri May 14 13:00:16.243994 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     return view_func(*args, **kwargs)
[Fri May 14 13:00:16.243999 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/rest_framework/viewsets.py", line 114, in view
[Fri May 14 13:00:16.244005 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     return self.dispatch(request, *args, **kwargs)
[Fri May 14 13:00:16.244010 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/rest_framework/views.py", line 505, in dispatch
[Fri May 14 13:00:16.244015 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     response = self.handle_exception(exc)
[Fri May 14 13:00:16.244021 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/rest_framework/views.py", line 465, in handle_exception
[Fri May 14 13:00:16.244026 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     self.raise_uncaught_exception(exc)
[Fri May 14 13:00:16.244031 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
[Fri May 14 13:00:16.244037 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     raise exc
[Fri May 14 13:00:16.244041 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/rest_framework/views.py", line 502, in dispatch
[Fri May 14 13:00:16.244047 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     response = handler(request, *args, **kwargs)

2021-05-14 13:00:16,244 DEBG 'runserver' stderr output:
[Fri May 14 13:00:16.244052 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 43, in _wrapper
[Fri May 14 13:00:16.244061 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     return bound_method(*args, **kwargs)
[Fri May 14 13:00:16.244066 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/home/django/cvat/apps/engine/views.py", line 402, in create
[Fri May 14 13:00:16.244071 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     os.close(rq_job.meta['tmp_file_descriptor'])
[Fri May 14 13:00:16.244076 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430] KeyError: 'tmp_file_descriptor'
[Fri May 14 13:00:16.244297 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430] ERROR - 2021-05-14 13:00:16,243 - log - Internal Server Error: /api/v1/tasks
[Fri May 14 13:00:16.244305 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430] Traceback (most recent call last):
[Fri May 14 13:00:16.244310 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
[Fri May 14 13:00:16.244315 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     response = get_response(request)
[Fri May 14 13:00:16.244320 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
[Fri May 14 13:00:16.244326 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Fri May 14 13:00:16.244331 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
[Fri May 14 13:00:16.244337 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     return view_func(*args, **kwargs)
[Fri May 14 13:00:16.244342 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/rest_framework/viewsets.py", line 114, in view
[Fri May 14 13:00:16.244348 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     return self.dispatch(request, *args, **kwargs)
[Fri May 14 13:00:16.244353 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/rest_framework/views.py", line 505, in dispatch
[Fri May 14 13:00:16.244358 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     response = self.handle_exception(exc)
[Fri May 14 13:00:16.244363 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/rest_framework/views.py", line 465, in handle_exception
[Fri May 14 13:00:16.244368 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     self.raise_uncaught_exception(exc)
[Fri May 14 13:00:16.244373 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
[Fri May 14 13:00:16.244379 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     raise exc
[Fri May 14 13:00:16.244383 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/rest_framework/views.py", line 502, in dispatch
[Fri May 14 13:00:16.244389 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     response = handler(request, *args, **kwargs)
[Fri May 14 13:00:16.244394 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/opt/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 43, in _wrapper
[Fri May 14 13:00:16.244406 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     return bound_method(*args, **kwargs)
[Fri May 14 13:00:16.244411 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]   File "/home/django/cvat/apps/engine/views.py", line 402, in create
[Fri May 14 13:00:16.244417 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430]     os.close(rq_job.meta['tmp_file_descriptor'])
[Fri May 14 13:00:16.244422 2021] [wsgi:error] [pid 633:tid 140235986036480] [remote 172.28.0.6:53430] KeyError: 'tmp_file_descriptor'

@nmanovic
Copy link
Contributor

@azhavoro , also the list of tasks isn't updated. Need to refresh the whole site or go to projects and come back to tasks.

@nmanovic
Copy link
Contributor

@azhavoro , I see great process with the layout of the exported archive. Could we do one more step forward?

  • Let's use label's name as its id and remove id: number from the specification. The same change should work for attributes as well.
  • Let's use local index of a job as its id and remove id: number from the specification
  • Let's use local index of a shape as its id and remove id: number from the specification
  • Let's use an array inside annotations.json where first dictionary corresponds to first job, second dictionary corresponds to second job, and so on.

Can it be implemented from your point of view? Will we loose any information?

@nmanovic
Copy link
Contributor

Another exception when try to export a task:

2021-05-14 13:35:27,778 DEBG 'rqworker_default_0' stderr output:
ERROR - 2021-05-14 13:35:27,778 - worker - Traceback (most recent call last):
  File "/opt/venv/lib/python3.8/site-packages/rq/worker.py", line 936, in perform_job
    rv = job.perform()
  File "/opt/venv/lib/python3.8/site-packages/rq/job.py", line 684, in perform
    self._result = self._execute()
  File "/opt/venv/lib/python3.8/site-packages/rq/job.py", line 690, in _execute
    return self.func(*self.args, **self.kwargs)
  File "/home/django/cvat/apps/dataset_manager/views.py", line 114, in backup_task
    task_exporter.export_to(temp_file)
  File "/home/django/cvat/apps/engine/backup.py", line 241, in export_to
    self._write_manifest(output_file)
  File "/home/django/cvat/apps/engine/backup.py", line 215, in _write_manifest
    task['jobs'] = serialize_jobs()
  File "/home/django/cvat/apps/engine/backup.py", line 197, in serialize_jobs
    job_data = self._prepare_job_meta(job_serializer.data)
  File "/opt/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 562, in data
    ret = super().data
  File "/opt/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 260, in data
    self._data = self.to_representation(self.instance)
  File "/opt/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 529, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "/opt/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 529, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "/opt/venv/lib/python3.8/site-packages/rest_framework/relations.py", line 370, in to_representation
    assert 'request' in self.context, (
AssertionError: `HyperlinkedIdentityField` requires the request in the serializer context. Add `context={'request': request}` when instantiating the serializer.

@nmanovic
Copy link
Contributor

@azhavoro , also I see "index.json" file which should be created on the fly.

@nmanovic
Copy link
Contributor

Now we have tasks.json

{
    "name": "tracking video",
    "bug_tracker": "",
    "status": "annotation",
    "labels": [
        {
            "id": 12,
            "name": "person",
            "color": "#c06060",
            "attributes": []
        }
    ],
    "subset": "",
    "version": "1.0",
    "data": {
        "chunk_size": 72,
        "image_quality": 70,
        "start_frame": 0,
        "stop_frame": 794,
        "storage_method": "file_system",
        "storage": "local",
        "chunk_type": "imageset"
    },
    "jobs": [
        {
            "start_frame": 0,
            "stop_frame": 794,
            "id": 6,
            "status": "annotation"
        }
    ]
}

Can we have something like json below?

{
    "name": "tracking video",
    "bug_tracker": "",
    "status": "annotation",
    "labels": [
        {
            "name": "person",
            "color": "#c06060",
            "attributes": []
        }
    ],
    "subset": "",
    "version": "1.0",
    "data": {
        "chunk_size": 72,
        "image_quality": 70,
        "start_frame": 0,
        "stop_frame": 794,
        "storage_method": "file_system",
        "storage": "local",
        "chunk_type": "imageset"
    },
    "jobs": [
        {
            "start_frame": 0,
            "stop_frame": 794,
            "status": "annotation"
        }
    ]
}

@nmanovic
Copy link
Contributor

For annotations.json before:

{
    "16": {
        "version": 3,
        "tags": [],
        "shapes": [
            {
                "type": "rectangle",
                "occluded": false,
                "z_order": 0,
                "points": [
                    971.5869140625,
                    462.3623046875,
                    1020.4619140625,
                    582.5683822631836
                ],
                "frame": 0,
                "label_id": 22,
                "group": 0,
                "source": "manual",
                "attributes": []
            },
            {
                "type": "rectangle",
                "occluded": false,
                "z_order": 0,
                "points": [
                    1190.86328125,
                    590.4931640625,
                    1256.9105758666992,
                    715.9830322265625
                ],
                "frame": 0,
                "label_id": 22,
                "group": 0,
                "source": "manual",
                "attributes": []
            },
            {
                "type": "rectangle",
                "occluded": false,
                "z_order": 0,
                "points": [
                    527.7490234375,
                    516.5205078125,
                    717.9652404785156,
                    721.2671356201172
                ],
                "frame": 0,
                "label_id": 22,
                "group": 0,
                "source": "manual",
                "attributes": []
            }
        ],
        "tracks": []
    }
}

And after my suggestions:

[
    {
        "version": 3,
        "tags": [],
        "shapes": [
            {
                "type": "rectangle",
                "occluded": false,
                "z_order": 0,
                "points": [
                    971.5869140625,
                    462.3623046875,
                    1020.4619140625,
                    582.5683822631836
                ],
                "frame": 0,
                "label": "person",
                "group": 0,
                "source": "manual",
                "attributes": []
            },
            {
                "type": "rectangle",
                "occluded": false,
                "z_order": 0,
                "points": [
                    1190.86328125,
                    590.4931640625,
                    1256.9105758666992,
                    715.9830322265625
                ],
                "frame": 0,
                "label": "person",
                "group": 0,
                "source": "manual",
                "attributes": []
            },
            {
                "type": "rectangle",
                "occluded": false,
                "z_order": 0,
                "points": [
                    527.7490234375,
                    516.5205078125,
                    717.9652404785156,
                    721.2671356201172
                ],
                "frame": 0,
                "label": "person",
                "group": 0,
                "source": "manual",
                "attributes": []
            }
        ],
        "tracks": []
    }
]

@nmanovic
Copy link
Contributor

FYI: Extra id: number we have for tracked shapes.

@nmanovic
Copy link
Contributor

In tasks.json we have "storage" and "storage_method". Do we really need both?

@bsekachev
Copy link
Member

If we export a task from a project, we can't import it back to the project. Is it known issue? We just do not have "Import task" button on the project page. The only way is to import and then move the task to the project (using this way in current implementation we lose all the annotated attributes).

task.json contains project field subset. How is it used?

django: defaul process fails if I send an archive without task.json

Extra offset of "Create new task" button:

Develop:
Screenshot from 2021-05-31 12-53-37

This branch:
Screenshot from 2021-05-31 12-53-20

@bsekachev
Copy link
Member

I exported a task with a finished job. Imported it and job in annotation status. I suppose the same works for jobs in reviews.

Also video task has overlap (5 default). Export, import it and now it has overlap 0.

@bsekachev
Copy link
Member

One more possible problem: Looks like issues aren't dumped together with annotations.

@nmanovic
Copy link
Contributor

nmanovic commented Jun 8, 2021

  • index.json should be removed
  • If I try to upload dump of annotations, I get 500 error code. It should be 400.
    (Error: Request failed with status code 500. "KeyError: "There is no item named 'task.json' in the archive"\n".)

@nmanovic
Copy link
Contributor

nmanovic commented Jun 8, 2021

  • In CVAT for images we have floating point numbers with 2 digits after the dot. Should we apply the same approach here? What do you think? Personally I don't have a strong opinion on the subject. Looks like it is good to have exactly the same as we have in DB. But at the same time for annotation formats we took another decision.

cache_dir = get_export_cache_dir(db_task)
output_path = osp.join(cache_dir, output_path)

task_time = timezone.localtime(db_task.updated_date).timestamp()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to adjust time for clearning_job somewhere here? I believe we have multiple races here. Several users can try to backup the same task in parallel. Clearning job can remove our file after all our successful checks.

Races are fine if they don't lead to unexpected results.

Copy link
Contributor

@nmanovic nmanovic left a comment

Choose a reason for hiding this comment

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

Let's merge the branch as is and try to fix remaining issues in the next PR.

@nmanovic nmanovic merged commit 72fdef4 into develop Jun 8, 2021
@nmanovic nmanovic deleted the az/import_export_tasks branch June 8, 2021 14:48
Comment on lines +193 to +194
self._db_task = models.Task.objects.prefetch_related('data__images').select_related('data__video').get(pk=pk)
self._db_data = self._db_task.data
Copy link
Member

Choose a reason for hiding this comment

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

@azhavoro
Probably there is the same problem like in the recent fix.
select_related(data__..) breaks prefetch_related(data__...)

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.

8 participants