thds.adls 3.2.20250604193858__py3-none-any.whl → 3.2.20250609172636__py3-none-any.whl
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.
Potentially problematic release.
This version of thds.adls might be problematic. Click here for more details.
- thds/adls/download.py +8 -0
- thds/adls/file_properties.py +4 -1
- thds/adls/resource/core.py +2 -4
- thds/adls/resource/file_pointers.py +2 -2
- thds/adls/resource/up_down.py +2 -5
- {thds_adls-3.2.20250604193858.dist-info → thds_adls-3.2.20250609172636.dist-info}/METADATA +1 -1
- {thds_adls-3.2.20250604193858.dist-info → thds_adls-3.2.20250609172636.dist-info}/RECORD +10 -10
- {thds_adls-3.2.20250604193858.dist-info → thds_adls-3.2.20250609172636.dist-info}/WHEEL +0 -0
- {thds_adls-3.2.20250604193858.dist-info → thds_adls-3.2.20250609172636.dist-info}/entry_points.txt +0 -0
- {thds_adls-3.2.20250604193858.dist-info → thds_adls-3.2.20250609172636.dist-info}/top_level.txt +0 -0
thds/adls/download.py
CHANGED
|
@@ -356,6 +356,7 @@ def download_or_use_verified(
|
|
|
356
356
|
co, co_request, file_properties, dl_file_client = _prep_download_coroutine(
|
|
357
357
|
fs_client, remote_key, local_path, md5b64, cache
|
|
358
358
|
)
|
|
359
|
+
_dl_scope.enter(dl_file_client) # on __exit__, will release the connection to the pool
|
|
359
360
|
while True:
|
|
360
361
|
if co_request == _IoRequest.FILE_PROPERTIES:
|
|
361
362
|
if not file_properties:
|
|
@@ -384,7 +385,11 @@ def download_or_use_verified(
|
|
|
384
385
|
translate_azure_error(fs_client, remote_key, err)
|
|
385
386
|
|
|
386
387
|
|
|
388
|
+
_async_dl_scope = scope.AsyncScope("adls.download.async")
|
|
389
|
+
|
|
390
|
+
|
|
387
391
|
@_dl_scope.bound
|
|
392
|
+
@_async_dl_scope.async_bound
|
|
388
393
|
async def async_download_or_use_verified(
|
|
389
394
|
fs_client: aio.FileSystemClient,
|
|
390
395
|
remote_key: str,
|
|
@@ -397,6 +402,9 @@ async def async_download_or_use_verified(
|
|
|
397
402
|
co, co_request, file_properties, dl_file_client = _prep_download_coroutine(
|
|
398
403
|
fs_client, remote_key, local_path, md5b64, cache
|
|
399
404
|
)
|
|
405
|
+
await _async_dl_scope.async_enter(
|
|
406
|
+
dl_file_client # type: ignore[arg-type]
|
|
407
|
+
) # on __aexit__, will release the connection to the pool
|
|
400
408
|
while True:
|
|
401
409
|
if co_request == _IoRequest.FILE_PROPERTIES:
|
|
402
410
|
if not file_properties:
|
thds/adls/file_properties.py
CHANGED
|
@@ -13,7 +13,10 @@ def is_directory(info: FileProperties) -> bool:
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def get_file_properties(fqn: AdlsFqn) -> FileProperties:
|
|
16
|
-
|
|
16
|
+
with get_global_fs_client(fqn.sa, fqn.container).get_file_client(fqn.path) as file_client:
|
|
17
|
+
# The file client is a context manager to ensure proper resource cleanup
|
|
18
|
+
# and to avoid keeping connections open longer than necessary.
|
|
19
|
+
return file_client.get_file_properties()
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
def get_blob_properties(fqn: AdlsFqn) -> BlobProperties:
|
thds/adls/resource/core.py
CHANGED
|
@@ -5,8 +5,8 @@ from thds.core import hashing, log, source
|
|
|
5
5
|
from thds.core.hashing import b64
|
|
6
6
|
|
|
7
7
|
from ..errors import blob_not_found_translation
|
|
8
|
+
from ..file_properties import get_file_properties
|
|
8
9
|
from ..fqn import AdlsFqn
|
|
9
|
-
from ..global_client import get_global_fs_client
|
|
10
10
|
from ..md5 import check_reasonable_md5b64
|
|
11
11
|
|
|
12
12
|
logger = log.getLogger(__name__)
|
|
@@ -72,8 +72,6 @@ def get(fqn_or_uri: ty.Union[AdlsFqn, str]) -> AdlsHashedResource:
|
|
|
72
72
|
"""
|
|
73
73
|
fqn = AdlsFqn.parse(fqn_or_uri) if isinstance(fqn_or_uri, str) else fqn_or_uri
|
|
74
74
|
with blob_not_found_translation(fqn):
|
|
75
|
-
props = (
|
|
76
|
-
get_global_fs_client(fqn.sa, fqn.container).get_file_client(fqn.path).get_file_properties()
|
|
77
|
-
)
|
|
75
|
+
props = get_file_properties(fqn)
|
|
78
76
|
assert props.content_settings.content_md5, "ADLS file has empty Content-MD5!"
|
|
79
77
|
return AdlsHashedResource.of(fqn, b64(props.content_settings.content_md5))
|
|
@@ -4,7 +4,7 @@ from pathlib import Path
|
|
|
4
4
|
|
|
5
5
|
from thds.core.hashing import b64
|
|
6
6
|
|
|
7
|
-
from ..
|
|
7
|
+
from ..file_properties import get_file_properties
|
|
8
8
|
from .core import AdlsHashedResource, parse, serialize
|
|
9
9
|
|
|
10
10
|
_AZURE_PLACEHOLDER_SIZE_LIMIT = 4096
|
|
@@ -47,7 +47,7 @@ def resource_to_path(
|
|
|
47
47
|
def validate_resource(srcfile: ty.Union[str, Path]) -> AdlsHashedResource:
|
|
48
48
|
res = resource_from_path(srcfile)
|
|
49
49
|
fqn, md5b64 = res
|
|
50
|
-
props =
|
|
50
|
+
props = get_file_properties(fqn)
|
|
51
51
|
md5 = props.content_settings.content_md5
|
|
52
52
|
assert md5, f"{fqn} was incorrectly uploaded to ADLS without an MD5 embedded."
|
|
53
53
|
assert md5b64 == b64(md5), f"You probably need to update the MD5 in {srcfile}"
|
thds/adls/resource/up_down.py
CHANGED
|
@@ -13,6 +13,7 @@ from .._upload import metadata_for_upload, upload_decision_and_settings
|
|
|
13
13
|
from ..conf import UPLOAD_FILE_MAX_CONCURRENCY
|
|
14
14
|
from ..download import download_or_use_verified
|
|
15
15
|
from ..errors import BlobNotFoundError
|
|
16
|
+
from ..file_properties import get_file_properties
|
|
16
17
|
from ..fqn import AdlsFqn
|
|
17
18
|
from ..global_client import get_global_blob_container_client, get_global_fs_client
|
|
18
19
|
from ..ro_cache import Cache, global_cache
|
|
@@ -166,11 +167,7 @@ def upload(
|
|
|
166
167
|
|
|
167
168
|
def verify_remote_md5(resource: AdlsHashedResource) -> bool:
|
|
168
169
|
try:
|
|
169
|
-
props = (
|
|
170
|
-
get_global_fs_client(resource.fqn.sa, resource.fqn.container)
|
|
171
|
-
.get_file_client(resource.fqn.path)
|
|
172
|
-
.get_file_properties()
|
|
173
|
-
)
|
|
170
|
+
props = get_file_properties(resource.fqn)
|
|
174
171
|
if props.content_settings.content_md5:
|
|
175
172
|
return hashing.b64(props.content_settings.content_md5) == resource.md5b64
|
|
176
173
|
except HttpResponseError:
|
|
@@ -7,11 +7,11 @@ thds/adls/conf.py,sha256=q1SPrgb46NpobVzwt_Oyv71-BvsIbZLq9nRWS3LZjz0,1990
|
|
|
7
7
|
thds/adls/copy.py,sha256=jUWbGvTpb4B3yRGS0nhGSbDzqRPzUqYgH0z1lFRJB3k,6365
|
|
8
8
|
thds/adls/dbfs.py,sha256=pPAjbIZRKJsaXKQljDMUgqS_zy1yKeEZHGMueXbuv3g,2219
|
|
9
9
|
thds/adls/defaults.py,sha256=GGq5Pn4r-8cX4bZItp4nnwWAAz7S07pzPoOegw0y5Fw,676
|
|
10
|
-
thds/adls/download.py,sha256=
|
|
10
|
+
thds/adls/download.py,sha256=c1GapH8e7H5AmGR7S2u6CJ-XqQaDdtVQ6tKIwjuMTio,18510
|
|
11
11
|
thds/adls/download_lock.py,sha256=ttD2GhPNRnITNoV1XH2PvKbMsHppZirjy3RZ4P4kgKM,2826
|
|
12
12
|
thds/adls/errors.py,sha256=B_rMsQvQnNmP_sf-x8kmGsv2vIeOh4G9kVbdNVyk350,1469
|
|
13
13
|
thds/adls/etag.py,sha256=ct7jpHhNFcKzbekn5rZ3m6DhjK48A7qOZGwDiHkc-pc,242
|
|
14
|
-
thds/adls/file_properties.py,sha256=
|
|
14
|
+
thds/adls/file_properties.py,sha256=DYUu4zI_5amwTSMbhvUVimSEfEsfpgoqOawQ4Z4W-nY,1790
|
|
15
15
|
thds/adls/fqn.py,sha256=0zHmHhBWN7GEfKRB3fBC1NVhaiIHHifBdCRanyT01X8,5822
|
|
16
16
|
thds/adls/global_client.py,sha256=f4VJw5y_Yh__8gQUcdSYTh1aU6iEPlauMchVirSAwDQ,3716
|
|
17
17
|
thds/adls/impl.py,sha256=4qa70w1sehzp60CI6lW82NLDK-lsM1uUfhPmZnYJaw0,42589
|
|
@@ -27,14 +27,14 @@ thds/adls/uri.py,sha256=pDH956p_VEHnjLLUnjWY6sGgRqksp9gdpc9KOW4gEP0,1205
|
|
|
27
27
|
thds/adls/azcopy/__init__.py,sha256=nTNbgz2GcEiGeswYbAgy4oPhivnzl_5crF3HqCdWWiw,31
|
|
28
28
|
thds/adls/azcopy/download.py,sha256=Fig6q-bRZBeoA5L-URl5BACfMH9-9_sc4T2sa9yiZyQ,6611
|
|
29
29
|
thds/adls/resource/__init__.py,sha256=IZ7_aRf1b3jEp7wXOxqHop0gV2gUcf9SOLeEEjIWlCU,1669
|
|
30
|
-
thds/adls/resource/core.py,sha256=
|
|
31
|
-
thds/adls/resource/file_pointers.py,sha256=
|
|
32
|
-
thds/adls/resource/up_down.py,sha256=
|
|
30
|
+
thds/adls/resource/core.py,sha256=u6iaJAbnk88Xfn6SQBgITDnvHpEFdMjUtE_fOgebbTU,2627
|
|
31
|
+
thds/adls/resource/file_pointers.py,sha256=2g5lUtauA5vCZ4-skxIdmLeOp4cLZ7Mtv-MAhq6nIsA,1983
|
|
32
|
+
thds/adls/resource/up_down.py,sha256=eTQMbeqM6edfVz18uHXRiOe0oEzOAaW1TBvym6lctNM,9822
|
|
33
33
|
thds/adls/tools/download.py,sha256=vvBO8lSDl9oPugv75qpCkoemT9pOM9BV6yeExlkyG08,1594
|
|
34
34
|
thds/adls/tools/ls.py,sha256=OgEaIfTK359twlZIj-A0AW_nv81Z6zi0b9Tw6OJJfWA,1083
|
|
35
35
|
thds/adls/tools/upload.py,sha256=eMk4pdug1aCMPDDWpIE3Zoq77i5APp9Uuh-sVCCDNJE,493
|
|
36
|
-
thds_adls-3.2.
|
|
37
|
-
thds_adls-3.2.
|
|
38
|
-
thds_adls-3.2.
|
|
39
|
-
thds_adls-3.2.
|
|
40
|
-
thds_adls-3.2.
|
|
36
|
+
thds_adls-3.2.20250609172636.dist-info/METADATA,sha256=LkbxgTwbHIptXGNJLjS1eMFUidt5FUzDz9NXhEyLdes,543
|
|
37
|
+
thds_adls-3.2.20250609172636.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
38
|
+
thds_adls-3.2.20250609172636.dist-info/entry_points.txt,sha256=uTqreT1AIwqJboMfLv5w6sviM8mNbAkln765gIjzoA4,152
|
|
39
|
+
thds_adls-3.2.20250609172636.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
|
|
40
|
+
thds_adls-3.2.20250609172636.dist-info/RECORD,,
|
|
File without changes
|
{thds_adls-3.2.20250604193858.dist-info → thds_adls-3.2.20250609172636.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{thds_adls-3.2.20250604193858.dist-info → thds_adls-3.2.20250609172636.dist-info}/top_level.txt
RENAMED
|
File without changes
|