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

Could not fetch frame data from the server (A manifest file not exists) #3119

Closed
nstolyarov opened this issue Apr 22, 2021 · 11 comments · Fixed by #3146
Closed

Could not fetch frame data from the server (A manifest file not exists) #3119

nstolyarov opened this issue Apr 22, 2021 · 11 comments · Fixed by #3146
Assignees
Labels
bug Something isn't working

Comments

@nstolyarov
Copy link

My actions before raising this issue

When I try to enter into any job in concrete task, I can't see any images and I get the following error:

Could not fetch frame data from the server
Error: . "\"cannot get requested data type: chunk, number: 0, quality: Quality.COMPRESSED\\nA manifest file not exists, index cannot be created\"".

task_issue

I've found the following logs in cvat container for this task:

[2021-04-22 11:14:26,412] ERROR cvat.server.task_52: cannot get requested data type: chunk, number: 0, quality: Quality.COMPRESSED
Traceback (most recent call last):
  File "/home/django/cvat/apps/engine/views.py", line 470, in data
    buff, mime_type = frame_provider.get_chunk(data_id, data_quality)
  File "/home/django/cvat/apps/engine/frame_provider.py", line 167, in get_chunk
    return self._loaders[quality].get_chunk_path(chunk_number, quality, self._db_data)
  File "/home/django/cvat/apps/engine/cache.py", line 29, in get_buff_mime
    chunk, tag = self.prepare_chunk_buff(db_data, quality, chunk_number)
  File "/home/django/cvat/apps/engine/cache.py", line 63, in prepare_chunk_buff
    reader = ImageDatasetManifestReader(manifest_path=db_data.get_manifest_path(),
  File "/home/django/cvat/apps/engine/media_extractors.py", line 361, in __init__
    self._manifest.init_index()
  File "/home/django/utils/dataset_manifest/core.py", line 287, in init_index
    self._index.create(self._manifest.path, 3 if self._manifest.TYPE == 'video' else 2)
  File "/home/django/utils/dataset_manifest/core.py", line 224, in create
    assert os.path.exists(manifest), 'A manifest file not exists, index cannot be created'
AssertionError: A manifest file not exists, index cannot be created
[2021-04-22 11:25:37,711] INFO cvat.server.task_52: get repository request

I've found that it is still possible to dump annotations but I can't export the full dataset.

Expected Behaviour

Images in the job should be loaded properly.

Current Behaviour

Images are not loaded in the task with error notification.

Context

Due to this issue I can't load the full dataset

Your Environment

  • Git hash commit (git log -1):
commit be9e00fa7aeba432690901d54509760eb9ebfba4 (HEAD -> develop, origin/develop, origin/HEAD)
Author: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com>
Date:   Wed Apr 21 14:47:58 2021 +0300

    Update cypress test. Canvas 3D functionality. Basic actions. (#3112)
    
    * Rename, add css class
    
    * Update cypress test.

  • Docker version docker version (e.g. Docker 17.0.05): 20.10.05
  • Are you using Docker Swarm or Kubernetes? Nope
  • Operating System and version (e.g. Linux, Windows, MacOS): GNU/Linux Ubuntu 4.15.0-140-generic
@azhavoro azhavoro added the bug Something isn't working label Apr 22, 2021
@Marishka17
Copy link
Contributor

@nstolyarov , Could you please describe in more detail the current task, from what data did you create this task, what parameters did you use?
Also, the task was available before migration (in this case, have you seen any errors when migrating data?) / the task is not available immediately after creation?

@nstolyarov
Copy link
Author

Some update:

Seems it has happened after some update with git pull and docker-compose -f ./docker-compose.yml -f ./docker-compose.dev.yml -f docker-compose.override.yml up --build.

@nstolyarov
Copy link
Author

nstolyarov commented Apr 22, 2021

I created this task from connected file share images with image quality 70% and segment size 20. All other options were set by default.

And yes, it was available earlier.

Guess I created this task on the following commit:

commit 7a2dcff (HEAD -> develop, origin/develop, origin/HEAD)
Author: Anastasia Yasakova anastasia.yasakova@intel.com
Date: Tue Mar 9 10:41:33 2021 +0300

But I'm not sure, maybe it was on later commit.

@nstolyarov
Copy link
Author

Update x2:

It affects on this task and all the previous tasks.

@Marishka17
Copy link
Contributor

Marishka17 commented Apr 22, 2021

Could I ask you to check the data folder data/data/{data_id}/raw/ for existing or no dummy_{N}.txt files(for images)?

@nstolyarov
Copy link
Author

Hi, @Marishka17 !

There is nothing in this folder for this task and the same situation is for all previous tasks. But for other tasks everything is ok.

@Marishka17
Copy link
Contributor

  1. Maybe you still have migration logs?
  2. All tasks that are now inaccessible were created with share? In this case, was share available at the time of data migration?

@nstolyarov
Copy link
Author

  1. There was no migration cause we start our work with CVAT from Support for VGGFace2 dataset format #2865 . Perhaps I am misunderstanding what migration is?
  2. Yes, all tasks were created with share. And yes, share is available all the time.

@bsekachev
Copy link
Member

bsekachev commented Apr 23, 2021

@Marishka17

Would generation a Manifest file on the fly if it does not exist be an option to fix?
I think it should not take long time (both implementation and generation).

@Marishka17
Copy link
Contributor

Follow below steps to create missing manifest files:

  1. create manually_migrate.py
import glob
import os
from re import search
from django.conf import settings
from django.db import migrations
from cvat.apps.engine.models import DimensionType, StorageChoice,StorageMethodChoice
from utils.dataset_manifest import ImageManifestManager, VideoManifestManager
from cvat.apps.engine.models import Data
query_set = Data.objects.filter(storage_method=StorageMethodChoice.CACHE)
with open("exceptions_log.txt", "w") as log_file:
    for db_data in query_set:
        try:
            upload_dir = '{}/{}/raw'.format(settings.MEDIA_DATA_ROOT, db_data.id)
            if os.path.exists(os.path.join(upload_dir, 'meta_info.txt')):
                    os.remove(os.path.join(upload_dir, 'meta_info.txt'))
            else:
                for path in glob.glob(f'{upload_dir}/dummy_*.txt'):
                    os.remove(path)
            if os.path.exists(os.path.join(upload_dir, 'manifest.jsonl')):
                continue
            data_dir = upload_dir if db_data.storage == StorageChoice.LOCAL else settings.SHARE_ROOT
            if hasattr(db_data, 'video'):
                media_file = os.path.join(data_dir, db_data.video.path)
                manifest = VideoManifestManager(manifest_path=upload_dir)
                meta_info = manifest.prepare_meta(media_file=media_file)
                manifest.create(meta_info)
                manifest.init_index()
            else:
                manifest = ImageManifestManager(manifest_path=upload_dir)
                sources = []
                if db_data.storage == StorageChoice.LOCAL:
                    for (root, _, files) in os.walk(data_dir):
                        sources.extend([os.path.join(root, f) for f in files])
                    sources.sort()
                else:
                    sources = [os.path.join(data_dir, db_image.path) for db_image in db_data.images.all().order_by('frame')]
                if any(list(filter(lambda x: x.dimension==DimensionType.DIM_3D, db_data.tasks.all()))):
                    content = []
                    for source in sources:
                        name, ext = os.path.splitext(os.path.relpath(source, upload_dir))
                        content.append({
                            'name': name,
                            'extension': ext
                        })
                else:
                    meta_info = manifest.prepare_meta(sources=sources, data_dir=data_dir)
                    content = meta_info.content

                if db_data.storage == StorageChoice.SHARE:
                    def _get_frame_step(str_):
                        match = search("step\s*=\s*([1-9]\d*)", str_)
                        return int(match.group(1)) if match else 1
                    step = _get_frame_step(db_data.frame_filter)
                    start = db_data.start_frame
                    stop = db_data.stop_frame + 1
                    images_range = range(start, stop, step)
                    result_content = []
                    for i in range(stop):
                        item = content.pop(0) if i in images_range else dict()
                        result_content.append(item)
                    content = result_content
                manifest.create(content)
                manifest.init_index()
        except Exception as ex:
            log_file.write(str(ex))
  1. docker cp /path/to/manually_migrate.py cvat:/home/django/
  2. docker exec -it cvat /bin/bash
  3. python3 manage.py shell
  4. exec(open('manually_migrate.py').read())

@nstolyarov
Copy link
Author

nstolyarov commented Apr 26, 2021

Hi, @Marishka17!

Thank you, the proposed script solved this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants