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

CVAT API doesn't actually support TUS upload #5277

Closed
2 tasks done
paniccia-taurob opened this issue Nov 10, 2022 · 2 comments
Closed
2 tasks done

CVAT API doesn't actually support TUS upload #5277

paniccia-taurob opened this issue Nov 10, 2022 · 2 comments

Comments

@paniccia-taurob
Copy link

paniccia-taurob commented Nov 10, 2022

My actions before raising this issue

According to the TUS protocol: https://tus.io/protocols/resumable-upload.html#core-protocol there are 3 methods that are to be provided: POST, HEAD and PATCH.
The Current CVAT API only offers two: POST task/{task_id}/data/ and HEAD task/{task_id}/data/{file_id}.
Some clients start the upload using a "HEAD" request, which returns a 405 status (method not allowed).

Expected Behaviour

The HEAD method is provided, returning the current offset as per TUS specification.

Current Behaviour

No HEAD method allowed, which implies no resumption of an upload can be done.

Steps to Reproduce (for bugs)

Using the aiotus TUS client library (https://aiotus.readthedocs.io/en/latest/), test code is this one:

            with open(file_path, "rb") as picture:

                location = await aiotus.upload(
                    task_url,
                    picture,
                    {
                        "Content-Type": content_type.encode(),
                        "filename": file_path.encode(),
                    },
                    config=aiotus.RetryConfiguration(),
                    client_session=session,
                    chunksize=1024,
                )
                if location is None:
                    return False
                return True

This will yield in the logs:

DEBUG:aiotus:Creating upload...
DEBUG:aiotus:Getting offset of http://localhost:8080/api/tasks/18/data/0d609b5c-a574-4605-b291-339aca1810a6...
WARNING:aiotus:Upload failed, retrying in 1 second(s): 405, message='Method Not Allowed', url=URL('http://localhost:8080/api/tasks/18/data/0d609b5c-a574-4605-b291-339aca1810a6')

Context

The task I was working on was to set up an automatic uploader script that works from a local application producing pictures to be annotated.

Your Environment

  • Git hash commit (git log -1): n/a - using docker tag v2.2.0
  • Docker version docker version (e.g. Docker 17.0.05): 20.10.21
  • Are you using Docker Swarm or Kubernetes? Docker
  • Operating System and version (e.g. Linux, Windows, MacOS): Linux, Ubuntu 18.04
  • Code example or link to GitHub repo or gist to reproduce problem:
  • Other diagnostic information / logs:
    Logs from `cvat-server` container

2022-11-10 13:01:53,776 DEBG 'runserver' stderr output:
[Thu Nov 10 13:01:53.776822 2022] [wsgi:error] [pid 67:tid 139769879004928] [remote 172.18.0.7:51930] [2022-11-10 13:01:53,776] WARNING django.request: Method Not Allowed: /api/tasks/18/data/0d609b5c-a574-4605-b291-339aca1810a6

2022-11-10 13:01:53,777 DEBG 'runserver' stderr output:
[Thu Nov 10 13:01:53.776969 2022] [wsgi:error] [pid 67:tid 139769879004928] [remote 172.18.0.7:51930] WARNING:django.request:Method Not Allowed: /api/tasks/18/data/0d609b5c-a574-4605-b291-339aca1810a6

@paniccia-taurob
Copy link
Author

This is also related to #5261

@paniccia-taurob
Copy link
Author

Fixed by #4839

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

No branches or pull requests

1 participant