Skip to content

Commit

Permalink
Fixed error when getting data from CS and cache=True
Browse files Browse the repository at this point in the history
  • Loading branch information
azhavoro committed Oct 2, 2023
1 parent 92906a7 commit 24f2d7f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cvat/apps/engine/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _get_images(db_data, chunk_number):

cloud_storage_instance.bulk_download_to_dir(files=files_to_download, upload_dir=tmp_dir)

for checksum, fs_filename in zip(checksums, images):
for checksum, (_, fs_filename, _) in zip(checksums, images):
if checksum and not md5_hash(fs_filename) == checksum:
slogger.cloud_storage[db_cloud_storage.id].warning('Hash sums of files {} do not match'.format(file_name))
else:
Expand Down
27 changes: 27 additions & 0 deletions tests/python/rest_api/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,33 @@ def test_create_task_with_file_pattern(
status = self._test_cannot_create_task(self._USERNAME, task_spec, data_spec)
assert "No media data found" in status.message

@pytest.mark.with_external_services
@pytest.mark.parametrize("cloud_storage_id, org", [(1, ""),])
def test_create_task_with_cloud_storage_and_retrieve_data(
self,
cloud_storage_id,
cloud_storages,
request,
org,
):

cloud_storage = cloud_storages[cloud_storage_id]
task_id, _ = self._create_task_with_cloud_data(
request=request,
cloud_storage=cloud_storage,
use_manifest=True,
use_cache = True,
server_files=[],
org=org,
)

with make_api_client(self._USERNAME) as api_client:
(_, response) = api_client.tasks_api.retrieve_data(
task_id, type="chunk", quality="compressed", number=0
)
assert response.status == HTTPStatus.OK


def test_can_specify_file_job_mapping(self):
task_spec = {
"name": f"test file-job mapping",
Expand Down

0 comments on commit 24f2d7f

Please sign in to comment.