-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Create new task not working after CVAT upgrade #7377
Comments
Hello, how can we reproduce the issue? |
Hello, sorry for the delay. I'm not sure exactly how to reproduce my issue, but it seems to be a problem with migrating from Postgres 10 to Postgres 15. I followed the linked instruction pages (CVAT upgrade, Postgres upgrade guides) exactly. Below are the logs from cvat_worker_import. 2024-02-02 14:38:40,901 DEBG 'rqworker-import-1' stderr output: 2024-02-02 14:38:40,902 DEBG 'rqworker-import-1' stderr output: 2024-02-02 14:38:40,903 DEBG 'rqworker-import-1' stderr output: 2024-02-02 14:38:40,903 DEBG 'rqworker-import-1' stderr output: 2024-02-02 14:40:57,995 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:57,995 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:57,996 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,021 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,022 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,023 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,029 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,029 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,058 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,074 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,082 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,087 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,088 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,091 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,092 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,119 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,120 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,121 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,122 DEBG 'rqworker-import-0' stderr output: 2024-02-02 14:40:58,122 DEBG 'rqworker-import-0' stderr output: |
Actions before raising this issue
Steps to Reproduce
FROM UI
After this, inside the container, I can see that the folder /home/django/data/data/1070 does NOT exist.
FROM COMMAND LINE API IN PYTHON
task_id = create_new_task(auth, cvat_taskname, user_id, project_id, image_quality)
data = {
"image_quality": image_quality,
"compressed_chunk_type": "imageset",
"original_chunk_type": "imageset"
}
image_paths = []
for image in os.listdir(image_folder):
image_paths.append(os.path.join(image_folder, image))
files = {f'client_files[{i}]': open(f, 'rb') for i, f in enumerate(image_paths)}
req = server + api + tasks + f'/{task_id}/data'
upload_response = requests.post(req, data=data, files=files, auth=auth)
Failure
File "/home/django/cvat/apps/engine/media_extractors.py", line 215, in get_image_size
with Image.open(self._source_path[i]) as img:
File "/opt/venv/lib/python3.10/site-packages/PIL/Image.py", line 3243, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/home/django/data/data/1076/raw/12_06_WV03_VNIR_R1C1_tile_11_25
After this, inside the container, I can see that the folder /home/django/data/data/1070 DOES exist. I also tried re-uploading data to the same task using the API in Python:
task_id = same as above
data = {
"image_quality": image_quality,
"compressed_chunk_type": "imageset",
"original_chunk_type": "imageset"
}
image_paths = []
for image in os.listdir(image_folder):
image_paths.append(os.path.join(image_folder, image))
files = {f'client_files[{i}]': open(f, 'rb') for i, f in enumerate(image_paths)}
req = server + api + tasks + f'/{task_id}/data'
upload_response = requests.post(req, data=data, files=files, auth=auth)
Failure - response 500
File "/home/django/cvat/apps/engine/media_extractors.py", line 215, in get_image_size
with Image.open(self._source_path[i]) as img:
File "/opt/venv/lib/python3.10/site-packages/PIL/Image.py", line 3243, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/home/django/data/data/1076/raw/12_06_WV03_VNIR_R1C1_tile_11_25.jpg'
However, I can see that this file does in fact exist in the cvat_server container.
Before this, I had upgraded my version of CVAT following the instructions here:
https://opencv.github.io/cvat/docs/administration/advanced/upgrade_guide/
https://opencv.github.io/cvat/docs/administration/advanced/upgrade_guide/#how-to-upgrade-postgresql-database-base-image
https://opencv.github.io/cvat/docs/administration/basics/installation/#how-to-pullbuildupdate-cvat-images
I can see all of my old data in CVAT and open up old tasks/jobs, I just can't create new ones.
Expected Behavior
After upgrading CVAT and migrating data, I expect to see all of my old data and be able to add new tasks.
Possible Solution
No response
Context
cvat_db logs:
2024-01-19 17:39:34.155 UTC [22] LOG: checkpoint complete: wrote 84 buffers (0.5%); 0 WAL file(s) added, 0 removed, 0 recycled; write=8.082 s, sync=0.134 s, total=8.330 s; sync files=60, longest=0.086 s, average=0.003 s; distance=320 kB, estimate=320 kB
2024-01-19 17:44:25.239 UTC [22] LOG: checkpoint starting: time
2024-01-19 17:44:28.346 UTC [22] LOG: checkpoint complete: wrote 30 buffers (0.2%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.845 s, sync=0.120 s, total=3.107 s; sync files=29, longest=0.105 s, average=0.005 s; distance=78 kB, estimate=296 kB
2024-01-19 17:49:25.379 UTC [22] LOG: checkpoint starting: time
cvat_server logs:
AFTER UI:
2024-01-19 19:24:21,688 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "GET /api/projects/36 HTTP/1.0" 200 OK
2024-01-19 19:24:21,868 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "GET /api/labels?project_id=36&org=&page_size=500&page=1 HTTP/1.0" 200 OK
2024-01-19 19:24:22,194 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks?org= HTTP/1.0" 201 Created
2024-01-19 19:24:22,385 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 202 Accepted
2024-01-19 19:24:22,680 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "POST /api/events?org= HTTP/1.0" 201 Created
2024-01-19 19:24:22,861 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:23,228 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:23,794 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:24,394 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:24,786 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:25,314 DEBG 'uvicorn-0' stdout output:
INFO: 172.28.0.2:0 - "GET /api/auth/rules HTTP/1.0" 304 Not Modified
2024-01-19 19:24:25,585 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:26,119 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:26,610 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:27,018 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:27,418 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:27,585 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 200 OK
2024-01-19 19:24:27,785 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1167/data?org= HTTP/1.0" 202 Accepted
2024-01-19 19:24:28,008 DEBG 'uvicorn-1' stdout output:
INFO: 10.202.16.142:0 - "GET /api/tasks/1167/status?org= HTTP/1.0" 200 OK
2024-01-19 19:24:28,302 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "DELETE /api/tasks/1167 HTTP/1.0" 204 No Content
AFTER API COMMAND LINE:
2024-01-19 19:20:42,895 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "POST /api/tasks/1166/data HTTP/1.0" 202 Accepted
2024-01-19 19:20:43,506 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "GET /api/tasks/1166/status HTTP/1.0" 200 OK
2024-01-19 19:20:45,093 DEBG 'uvicorn-0' stdout output:
INFO: 10.202.16.142:0 - "GET /api/tasks/1166/status HTTP/1.0" 200 OK
AFTER RESUBMIT UPLOAD IMAGES TO SAME TASK ID:
Traceback (most recent call last):
File "/opt/venv/lib/python3.10/site-packages/asgiref/sync.py", line 534, in thread_handler
raise exc_info[1]
File "/opt/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
File "/opt/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 253, in _get_response_async
response = await wrapped_callback(
File "/opt/venv/lib/python3.10/site-packages/asgiref/sync.py", line 479, in call
ret: _R = await loop.run_in_executor(
File "/opt/venv/lib/python3.10/site-packages/asgiref/current_thread_executor.py", line 40, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/venv/lib/python3.10/site-packages/asgiref/sync.py", line 538, in thread_handler
return func(*args, **kwargs)
File "/opt/venv/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
return view_func(*args, **kwargs)
File "/opt/venv/lib/python3.10/site-packages/rest_framework/viewsets.py", line 125, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/venv/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/opt/venv/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/opt/venv/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/opt/venv/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/home/django/cvat/apps/engine/views.py", line 1213, in data
return self.upload_data(request)
File "/home/django/cvat/apps/engine/mixins.py", line 237, in upload_data
return self.upload_finished(request)
File "/home/django/cvat/apps/engine/views.py", line 1097, in upload_finished
return _handle_upload_data(request)
File "/home/django/cvat/apps/engine/views.py", line 1027, in _handle_upload_data
self.append_files(request)
File "/usr/lib/python3.10/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/home/django/cvat/apps/engine/views.py", line 993, in append_files
self._append_upload_info_entries(client_files)
File "/home/django/cvat/apps/engine/views.py", line 943, in _append_upload_info_entries
task_data.client_files.bulk_create([
File "/opt/venv/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/venv/lib/python3.10/site-packages/django/db/models/query.py", line 803, in bulk_create
returned_columns = self._batched_insert(
File "/opt/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1831, in _batched_insert
self._insert(
File "/opt/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1805, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/opt/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1822, in execute_sql
cursor.execute(sql, params)
File "/opt/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/opt/venv/lib/python3.10/site-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "engine_clientfile_data_id_file_c9989a74_uniq"
DETAIL: Key (data_id, file)=(1074, /home/django/data/data/1074/raw/12_06_WV03_VNIR_R1C1_tile_11_25.jpg) already exists.
Environment
The text was updated successfully, but these errors were encountered: