thds.adls 4.1.20250702194306__py3-none-any.whl → 4.1.20250709174808__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.

@@ -73,19 +73,24 @@ def sync_fastpath(
73
73
  env=system_resources.restrict_usage(),
74
74
  )
75
75
  assert process.stdout
76
+ output_lines = list()
76
77
  with progress.azcopy_tracker(dl_file_client.url, download_request.size_bytes or 0) as track:
77
78
  for line in process.stdout:
78
79
  track(line)
80
+ output_lines.append(line.strip())
79
81
 
80
82
  process.wait()
81
83
  if process.returncode != 0:
82
- raise subprocess.SubprocessError(f"AzCopy failed with return code {process.returncode}")
84
+ raise subprocess.CalledProcessError(
85
+ process.returncode,
86
+ f"AzCopy failed with return code {process.returncode}\n\n" + "\n".join(output_lines),
87
+ )
83
88
  assert (
84
89
  download_request.temp_path.exists()
85
90
  ), f"AzCopy did not create the file at {download_request.temp_path}"
86
91
  return
87
92
 
88
- except (subprocess.CalledProcessError, FileNotFoundError):
93
+ except (subprocess.SubprocessError, FileNotFoundError):
89
94
  logger.warning("Falling back to Python SDK for download")
90
95
 
91
96
  logger.debug("Downloading %s using Python SDK", dl_file_client.url)
@@ -121,17 +126,22 @@ async def async_fastpath(
121
126
  assert copy_proc.stdout
122
127
 
123
128
  # Feed lines to the tracker asynchronously
129
+ output_lines = list()
124
130
  with progress.azcopy_tracker(dl_file_client.url, download_request.size_bytes or 0) as track:
125
131
  while True:
126
132
  line = await copy_proc.stdout.readline()
127
133
  if not line: # EOF
128
134
  break
129
135
  track(line.decode().strip())
136
+ output_lines.append(line.decode().strip())
130
137
 
131
138
  # Wait for process completion
132
139
  exit_code = await copy_proc.wait()
133
140
  if exit_code != 0:
134
- raise subprocess.SubprocessError()
141
+ raise subprocess.CalledProcessError(
142
+ exit_code,
143
+ f"AzCopy failed with return code {exit_code}\n\n" + "\n".join(output_lines),
144
+ )
135
145
 
136
146
  return
137
147
 
@@ -86,10 +86,15 @@ def run(
86
86
  env=system_resources.restrict_usage(),
87
87
  )
88
88
  assert process.stdout
89
+ output_lines = list()
89
90
  with progress.azcopy_tracker(uri.to_blob_windows_url(dest), size_bytes) as track:
90
91
  for line in process.stdout:
91
92
  track(line)
93
+ output_lines.append(line.strip())
92
94
 
93
95
  process.wait()
94
96
  if process.returncode != 0:
95
- raise subprocess.SubprocessError(f"AzCopy failed with return code {process.returncode}")
97
+ raise subprocess.CalledProcessError(
98
+ process.returncode,
99
+ f"AzCopy failed with return code {process.returncode}\n\n" + "\n".join(output_lines),
100
+ )
thds/adls/download.py CHANGED
@@ -7,6 +7,7 @@ import typing as ty
7
7
  from pathlib import Path
8
8
 
9
9
  import aiohttp.http_exceptions
10
+ import requests.exceptions
10
11
  from azure.core.exceptions import AzureError, HttpResponseError, ResourceModifiedError
11
12
  from azure.storage.filedatalake import DataLakeFileClient, FileProperties, FileSystemClient, aio
12
13
 
@@ -307,6 +308,7 @@ def _excs_to_retry() -> ty.Callable[[Exception], bool]:
307
308
  filter(
308
309
  None,
309
310
  (
311
+ requests.exceptions.ConnectionError,
310
312
  aiohttp.http_exceptions.ContentLengthError,
311
313
  aiohttp.client_exceptions.ClientPayloadError,
312
314
  getattr(
@@ -318,6 +320,18 @@ def _excs_to_retry() -> ty.Callable[[Exception], bool]:
318
320
  )
319
321
 
320
322
 
323
+ def _log_nonfatal_hash_error_exc(exc: Exception, url: str) -> None:
324
+ """Azure exceptions are very noisy."""
325
+ msg = "Unable to set hash for %s: %s"
326
+ exception_txt = str(exc)
327
+ log, extra_txt = (
328
+ (logger.debug, type(exc).__name__)
329
+ if ("AuthorizationPermissionMismatch" in exception_txt or "ConditionNotMet" in exception_txt)
330
+ else (logger.warning, exception_txt)
331
+ )
332
+ log(msg, url, extra_txt)
333
+
334
+
321
335
  @_dl_scope.bound
322
336
  def download_or_use_verified(
323
337
  fs_client: FileSystemClient,
@@ -360,7 +374,7 @@ def download_or_use_verified(
360
374
  assert file_properties
361
375
  dl_file_client.set_metadata(meta, **etag.match_etag(file_properties))
362
376
  except (HttpResponseError, ResourceModifiedError) as ex:
363
- logger.info(f"Unable to set Hash for {remote_key}: {ex}")
377
+ _log_nonfatal_hash_error_exc(ex, dl_file_client.url)
364
378
  return si.value.hit
365
379
  except AzureError as err:
366
380
  errors.translate_azure_error(fs_client, remote_key, err)
@@ -418,7 +432,7 @@ async def async_download_or_use_verified(
418
432
  await dl_file_client.set_metadata(meta, **etag.match_etag(file_properties)) # type: ignore[misc]
419
433
  # TODO - check above type ignore
420
434
  except (HttpResponseError, ResourceModifiedError) as ex:
421
- logger.info(f"Unable to set Hash for {remote_key}: {ex}")
435
+ _log_nonfatal_hash_error_exc(ex, dl_file_client.url)
422
436
  return si.value.hit
423
437
  except AzureError as err:
424
438
  errors.translate_azure_error(fs_client, remote_key, err)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thds.adls
3
- Version: 4.1.20250702194306
3
+ Version: 4.1.20250709174808
4
4
  Summary: ADLS tools
5
5
  Author-email: Trilliant Health <info@trillianthealth.com>
6
6
  License: MIT
@@ -7,7 +7,7 @@ thds/adls/conf.py,sha256=nTw3X1ilC3A_905jZH-rWXFsESeHAKQn5IghvfX2VIo,1991
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=HzmhHM0FAmxtCRkK9M7NajsIzIuHD74GuxP3dyLoP1Q,18266
10
+ thds/adls/download.py,sha256=WOpMXGUbWImBdkM4tSW7qnCbu7G_cRXKF5pFQVLPPxs,18772
11
11
  thds/adls/download_lock.py,sha256=tgT48l4C5_qmArGeq05gl7VlxT22dZBH2Xwxx0itE9o,3176
12
12
  thds/adls/errors.py,sha256=6cLg2E4SB8ic46PBzA3ynRH4b1oR8qRb07RBgKGJRxY,1783
13
13
  thds/adls/etag.py,sha256=ct7jpHhNFcKzbekn5rZ3m6DhjK48A7qOZGwDiHkc-pc,242
@@ -27,16 +27,16 @@ thds/adls/source_tree.py,sha256=yP_v2XrKxXqUOdZ-x8kqHhBFAuur3AlAq3zi4hHj4AE,2235
27
27
  thds/adls/upload.py,sha256=MRHK9Am-x5FKBPh1SXLTbPC1r0Xk0bGWNU8CcNuUMLo,6602
28
28
  thds/adls/uri.py,sha256=9MXuW_KfpPvzBc4ERxuTJ3vvi_6yr7e1kMAW9mx2zXM,1414
29
29
  thds/adls/azcopy/__init__.py,sha256=qn2dmT92EHcrtaQ8uwRoUgvtF6Fu3NQbhZItOBdIBmY,45
30
- thds/adls/azcopy/download.py,sha256=8shLbizgKr5WLmOitQ8TY28EVj2IdT7iSRmRgqFNLAg,6008
30
+ thds/adls/azcopy/download.py,sha256=MwkUaQTrrXRX9yip_hiLZXzSgGqyTDUxjr0MeXitWuo,6450
31
31
  thds/adls/azcopy/login.py,sha256=923UaewVMPFzkDSgCQsbl-_g7qdFhpXpF0MGNIy3T_A,1538
32
32
  thds/adls/azcopy/progress.py,sha256=K7TVmSiWfu561orL3GuOnlQX9VtVxWVECAq9NiweYNo,1387
33
33
  thds/adls/azcopy/system_resources.py,sha256=okgDEKAp0oWGQF7OKikbgJ9buBeiOgNaDYy-36j6dHo,761
34
- thds/adls/azcopy/upload.py,sha256=bvtYdbaFsZkOHFLDpeBlTKqw63P3_kbImInI04ZlekM,2601
34
+ thds/adls/azcopy/upload.py,sha256=0l5FzV9IgZ2iQhm4eKZjTdw4SO17bHd8VnwcTev1lUs,2761
35
35
  thds/adls/tools/download.py,sha256=CW2cWbCRdUqisVVVoqqvqk5Ved7pPGTkwnZj3uV0jy4,1587
36
36
  thds/adls/tools/ls.py,sha256=OgEaIfTK359twlZIj-A0AW_nv81Z6zi0b9Tw6OJJfWA,1083
37
37
  thds/adls/tools/upload.py,sha256=5WyWkpuVp2PETZ3O3ODlq8LXszSHU73ZMnIDZXPJdC8,442
38
- thds_adls-4.1.20250702194306.dist-info/METADATA,sha256=zgZubxCu37Sqrjn7b5NTJNlPxZbRgbcx-omuFBiVfMg,587
39
- thds_adls-4.1.20250702194306.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
- thds_adls-4.1.20250702194306.dist-info/entry_points.txt,sha256=uTqreT1AIwqJboMfLv5w6sviM8mNbAkln765gIjzoA4,152
41
- thds_adls-4.1.20250702194306.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
42
- thds_adls-4.1.20250702194306.dist-info/RECORD,,
38
+ thds_adls-4.1.20250709174808.dist-info/METADATA,sha256=-mRVDeTBKoaoIACUBVh0BokOp2jrVOM11eQLfSOP0E4,587
39
+ thds_adls-4.1.20250709174808.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ thds_adls-4.1.20250709174808.dist-info/entry_points.txt,sha256=uTqreT1AIwqJboMfLv5w6sviM8mNbAkln765gIjzoA4,152
41
+ thds_adls-4.1.20250709174808.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
42
+ thds_adls-4.1.20250709174808.dist-info/RECORD,,