rclone-api 1.0.99__py2.py3-none-any.whl → 1.0.100__py2.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.
- rclone_api/s3/chunk_uploader.py +15 -3
- {rclone_api-1.0.99.dist-info → rclone_api-1.0.100.dist-info}/METADATA +1 -1
- {rclone_api-1.0.99.dist-info → rclone_api-1.0.100.dist-info}/RECORD +7 -7
- {rclone_api-1.0.99.dist-info → rclone_api-1.0.100.dist-info}/LICENSE +0 -0
- {rclone_api-1.0.99.dist-info → rclone_api-1.0.100.dist-info}/WHEEL +0 -0
- {rclone_api-1.0.99.dist-info → rclone_api-1.0.100.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.0.99.dist-info → rclone_api-1.0.100.dist-info}/top_level.txt +0 -0
rclone_api/s3/chunk_uploader.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _thread
|
|
1
2
|
import json
|
|
2
3
|
import os
|
|
3
4
|
import time
|
|
@@ -433,6 +434,7 @@ def upload_file_multipart(
|
|
|
433
434
|
chunk_size: int = 16 * 1024 * 1024, # Default chunk size is 16MB; can be overridden
|
|
434
435
|
retries: int = 20,
|
|
435
436
|
max_chunks_before_suspension: int | None = None,
|
|
437
|
+
abort_transfer_on_failure: bool = False,
|
|
436
438
|
) -> MultiUploadResult:
|
|
437
439
|
"""Upload a file to the bucket using multipart upload with customizable chunk size."""
|
|
438
440
|
file_size = os.path.getsize(str(file_path))
|
|
@@ -494,7 +496,13 @@ def upload_file_multipart(
|
|
|
494
496
|
output=filechunks,
|
|
495
497
|
max_chunks=max_chunks_before_suspension,
|
|
496
498
|
) -> None:
|
|
497
|
-
|
|
499
|
+
try:
|
|
500
|
+
file_chunker(
|
|
501
|
+
upload_state=upload_state, output=output, max_chunks=max_chunks
|
|
502
|
+
)
|
|
503
|
+
except Exception:
|
|
504
|
+
_thread.interrupt_main()
|
|
505
|
+
raise
|
|
498
506
|
|
|
499
507
|
try:
|
|
500
508
|
thread_chunker = Thread(target=chunker_task, daemon=True)
|
|
@@ -507,7 +515,11 @@ def upload_file_multipart(
|
|
|
507
515
|
break
|
|
508
516
|
|
|
509
517
|
def task(upload_info=upload_info, file_chunk=file_chunk):
|
|
510
|
-
|
|
518
|
+
try:
|
|
519
|
+
return handle_upload(upload_info, file_chunk)
|
|
520
|
+
except Exception:
|
|
521
|
+
_thread.interrupt_main()
|
|
522
|
+
raise
|
|
511
523
|
|
|
512
524
|
fut = executor.submit(task)
|
|
513
525
|
|
|
@@ -540,7 +552,7 @@ def upload_file_multipart(
|
|
|
540
552
|
f"Multipart upload completed: {file_path} to {bucket_name}/{object_name}"
|
|
541
553
|
)
|
|
542
554
|
except Exception:
|
|
543
|
-
if upload_info.upload_id:
|
|
555
|
+
if upload_info.upload_id and abort_transfer_on_failure:
|
|
544
556
|
try:
|
|
545
557
|
s3_client.abort_multipart_upload(
|
|
546
558
|
Bucket=bucket_name, Key=object_name, UploadId=upload_info.upload_id
|
|
@@ -25,12 +25,12 @@ rclone_api/cmd/list_files.py,sha256=x8FHODEilwKqwdiU1jdkeJbLwOqUkUQuDWPo2u_zpf0,
|
|
|
25
25
|
rclone_api/experimental/flags.py,sha256=AHbTaFHuyYFm3pjdvbQ100jztOXOdNuxalMr8UjXnV4,4097
|
|
26
26
|
rclone_api/s3/api.py,sha256=VstlaEnBjO2JDQuCRLdTfUGvQLbfshlXXhAzimFv4Vc,3763
|
|
27
27
|
rclone_api/s3/basic_ops.py,sha256=hK3366xhVEzEcjz9Gk_8lFx6MRceAk72cax6mUrr6ko,2104
|
|
28
|
-
rclone_api/s3/chunk_uploader.py,sha256
|
|
28
|
+
rclone_api/s3/chunk_uploader.py,sha256=-GzafZ93Mm9go7BqOaq8svPsjAwtFbVuzVpFdtw8cVA,18283
|
|
29
29
|
rclone_api/s3/create.py,sha256=SK3IGHZwsSkoG4Zb4NCphcVg9_f7VifDKng-tExMS2s,3088
|
|
30
30
|
rclone_api/s3/types.py,sha256=81_3jwg6MGIxC-GxL-6zANzKO6au9C0BWvAqRyODxOM,1361
|
|
31
|
-
rclone_api-1.0.
|
|
32
|
-
rclone_api-1.0.
|
|
33
|
-
rclone_api-1.0.
|
|
34
|
-
rclone_api-1.0.
|
|
35
|
-
rclone_api-1.0.
|
|
36
|
-
rclone_api-1.0.
|
|
31
|
+
rclone_api-1.0.100.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
|
32
|
+
rclone_api-1.0.100.dist-info/METADATA,sha256=ZuM5x0cJJyMDGIi2HApzr4yqo9JdoMLCSOLyUiWkD9w,4480
|
|
33
|
+
rclone_api-1.0.100.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
|
|
34
|
+
rclone_api-1.0.100.dist-info/entry_points.txt,sha256=6eNqTRXKhVf8CpWNjXiOa_0Du9tHiW_HD2iQSXRsUg8,132
|
|
35
|
+
rclone_api-1.0.100.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
|
|
36
|
+
rclone_api-1.0.100.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|