specklia 1.9.39__tar.gz → 1.9.40__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {specklia-1.9.39 → specklia-1.9.40}/PKG-INFO +1 -1
- {specklia-1.9.39 → specklia-1.9.40}/specklia/chunked_transfer.py +4 -5
- {specklia-1.9.39 → specklia-1.9.40}/specklia.egg-info/PKG-INFO +1 -1
- {specklia-1.9.39 → specklia-1.9.40}/tests/test_chunked_transfer.py +3 -1
- {specklia-1.9.39 → specklia-1.9.40}/LICENCE +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/README.md +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/setup.cfg +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/setup.py +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/specklia/__init__.py +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/specklia/client.py +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/specklia/utilities.py +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/specklia.egg-info/SOURCES.txt +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/specklia.egg-info/dependency_links.txt +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/specklia.egg-info/requires.txt +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/specklia.egg-info/top_level.txt +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/tests/test_client.py +0 -0
- {specklia-1.9.39 → specklia-1.9.40}/tests/test_utilities.py +0 -0
|
@@ -21,7 +21,6 @@ IS PRIVATE BUT THIS PACKAGE IS PUBLIC!
|
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
from enum import Enum
|
|
24
|
-
from http import HTTPStatus
|
|
25
24
|
from io import BytesIO
|
|
26
25
|
from logging import Logger
|
|
27
26
|
import struct
|
|
@@ -34,6 +33,8 @@ from pandas import DataFrame
|
|
|
34
33
|
from pandas import read_feather
|
|
35
34
|
import requests
|
|
36
35
|
|
|
36
|
+
log = Logger(__name__)
|
|
37
|
+
|
|
37
38
|
CHUNK_DB_NAME = "data_transfer_chunks"
|
|
38
39
|
CHUNK_METADATA_COLLECTION_NAME = "chunk_metadata"
|
|
39
40
|
MAX_CHUNK_AGE_SECONDS = 3600
|
|
@@ -41,8 +42,6 @@ MAX_CHUNK_SIZE_BYTES = 5 * 1024 ** 2 # must be small enough to fit into an HTTP
|
|
|
41
42
|
CHUNK_DOWNLOAD_RETRIES = 10
|
|
42
43
|
CHUNK_DOWNLOAD_TIMEOUT_S = 10
|
|
43
44
|
|
|
44
|
-
log = Logger(__name__)
|
|
45
|
-
|
|
46
45
|
|
|
47
46
|
class ChunkSetStatus(Enum):
|
|
48
47
|
"""
|
|
@@ -78,16 +77,16 @@ def upload_chunks(api_address: str, chunks: List[Tuple[int, bytes]]) -> str:
|
|
|
78
77
|
response = requests.post(
|
|
79
78
|
api_address + f"/chunk/upload/{chunks[0][0]}-of-{len(chunks)}",
|
|
80
79
|
data=chunks[0][1])
|
|
80
|
+
response.raise_for_status()
|
|
81
81
|
log.info("response from very first /chunk/upload was '%s'", response.json())
|
|
82
|
-
assert response.status_code == HTTPStatus.OK, response.text
|
|
83
82
|
chunk_set_uuid = response.json()['chunk_set_uuid']
|
|
84
83
|
|
|
85
84
|
# post the rest of the chunks in a random order
|
|
86
85
|
for i, chunk in chunks[1:]:
|
|
87
86
|
response = requests.post(
|
|
88
87
|
api_address + f"/chunk/upload/{chunk_set_uuid}/{i}-of-{len(chunks)}", data=chunk)
|
|
88
|
+
response.raise_for_status()
|
|
89
89
|
log.info("response from subsequent /chunk/upload/uuid call was '%s'", response.text)
|
|
90
|
-
assert response.status_code == HTTPStatus.OK, response.text
|
|
91
90
|
|
|
92
91
|
return chunk_set_uuid
|
|
93
92
|
|
|
@@ -23,9 +23,11 @@ def test_upload_chunks():
|
|
|
23
23
|
|
|
24
24
|
mock_post.assert_has_calls([
|
|
25
25
|
call('wibble/chunk/upload/1-of-2', data=b'a'),
|
|
26
|
+
call().raise_for_status(),
|
|
26
27
|
call().json(),
|
|
27
28
|
call().json(),
|
|
28
|
-
call('wibble/chunk/upload/cheese/2-of-2', data=b'b')
|
|
29
|
+
call('wibble/chunk/upload/cheese/2-of-2', data=b'b'),
|
|
30
|
+
call().raise_for_status()])
|
|
29
31
|
|
|
30
32
|
|
|
31
33
|
def test_download_chunks():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|