rclone-api 1.3.27__py2.py3-none-any.whl → 1.3.28__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/s3_multipart_uploader.py +28 -0
- rclone_api/s3/upload_file_multipart.py +8 -1
- {rclone_api-1.3.27.dist-info → rclone_api-1.3.28.dist-info}/METADATA +1 -1
- {rclone_api-1.3.27.dist-info → rclone_api-1.3.28.dist-info}/RECORD +8 -7
- {rclone_api-1.3.27.dist-info → rclone_api-1.3.28.dist-info}/LICENSE +0 -0
- {rclone_api-1.3.27.dist-info → rclone_api-1.3.28.dist-info}/WHEEL +0 -0
- {rclone_api-1.3.27.dist-info → rclone_api-1.3.28.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.3.27.dist-info → rclone_api-1.3.28.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
import _thread
|
2
|
+
import os
|
3
|
+
import traceback
|
4
|
+
import warnings
|
5
|
+
from concurrent.futures import Future, ThreadPoolExecutor
|
6
|
+
from pathlib import Path
|
7
|
+
from queue import Queue
|
8
|
+
from threading import Event, Thread
|
9
|
+
from typing import Any, Callable
|
10
|
+
|
11
|
+
from botocore.client import BaseClient
|
12
|
+
|
13
|
+
from rclone_api.mount_read_chunker import FilePart
|
14
|
+
from rclone_api.s3.chunk_task import S3FileInfo, file_chunker
|
15
|
+
from rclone_api.s3.chunk_types import (
|
16
|
+
FinishedPiece,
|
17
|
+
UploadInfo,
|
18
|
+
UploadState,
|
19
|
+
)
|
20
|
+
from rclone_api.s3.types import MultiUploadResult
|
21
|
+
from rclone_api.types import EndOfStream
|
22
|
+
from rclone_api.util import locked_print
|
23
|
+
|
24
|
+
|
25
|
+
class S3MultiPartUploader:
|
26
|
+
|
27
|
+
def __init__(s3_client: BaseClient, bucket_name: str, object_name: str, chunk_size: int, file_size: int):
|
28
|
+
pass
|
@@ -149,6 +149,10 @@ def upload_runner(
|
|
149
149
|
queue_upload: Queue[FilePart | EndOfStream],
|
150
150
|
cancel_chunker_event: Event,
|
151
151
|
) -> None:
|
152
|
+
# import semaphre
|
153
|
+
import threading
|
154
|
+
|
155
|
+
semaphore = threading.Semaphore(upload_threads)
|
152
156
|
with ThreadPoolExecutor(max_workers=upload_threads) as executor:
|
153
157
|
try:
|
154
158
|
while True:
|
@@ -159,9 +163,12 @@ def upload_runner(
|
|
159
163
|
def task(upload_info=upload_info, file_chunk=file_chunk):
|
160
164
|
return handle_upload(upload_info, file_chunk)
|
161
165
|
|
166
|
+
semaphore.acquire()
|
167
|
+
|
162
168
|
fut = executor.submit(task)
|
163
169
|
|
164
170
|
def done_cb(fut=fut):
|
171
|
+
semaphore.release()
|
165
172
|
result = fut.result()
|
166
173
|
if isinstance(result, Exception):
|
167
174
|
warnings.warn(f"Error uploading part: {result}, skipping")
|
@@ -233,7 +240,7 @@ def upload_file_multipart(
|
|
233
240
|
)
|
234
241
|
return upload_state
|
235
242
|
|
236
|
-
work_que_max =
|
243
|
+
work_que_max = 1
|
237
244
|
|
238
245
|
new_state = make_new_state()
|
239
246
|
loaded_state = get_upload_state()
|
@@ -40,11 +40,12 @@ rclone_api/s3/basic_ops.py,sha256=hK3366xhVEzEcjz9Gk_8lFx6MRceAk72cax6mUrr6ko,21
|
|
40
40
|
rclone_api/s3/chunk_task.py,sha256=AanVCygDoUjmMOUdEIYl-hEpPEGSJTIU_MSFGQ0tI0Q,7421
|
41
41
|
rclone_api/s3/chunk_types.py,sha256=oSWv8No9V3BeM7IcGnowyR2a7YrszdAXzEJlxaeZcp0,8852
|
42
42
|
rclone_api/s3/create.py,sha256=wgfkapv_j904CfKuWyiBIWJVxfAx_ftemFSUV14aT68,3149
|
43
|
+
rclone_api/s3/s3_multipart_uploader.py,sha256=JxUjf-Dpeq_JnMr8RBGuNCFcljGr_GM11529W53n3AM,766
|
43
44
|
rclone_api/s3/types.py,sha256=Elmh__gvZJyJyElYwMmvYZIBIunDJiTRAbEg21GmsRU,1604
|
44
|
-
rclone_api/s3/upload_file_multipart.py,sha256=
|
45
|
-
rclone_api-1.3.
|
46
|
-
rclone_api-1.3.
|
47
|
-
rclone_api-1.3.
|
48
|
-
rclone_api-1.3.
|
49
|
-
rclone_api-1.3.
|
50
|
-
rclone_api-1.3.
|
45
|
+
rclone_api/s3/upload_file_multipart.py,sha256=55TXp9q1It5nKkwBo49nCZNgvdMsqvIGByDMBFzo_ik,12576
|
46
|
+
rclone_api-1.3.28.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
47
|
+
rclone_api-1.3.28.dist-info/METADATA,sha256=JkcK7CZWmK6d5PEF3vYvlWIOGnb7ZIXNraPEH3HQUHM,4628
|
48
|
+
rclone_api-1.3.28.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
|
49
|
+
rclone_api-1.3.28.dist-info/entry_points.txt,sha256=fJteOlYVwgX3UbNuL9jJ0zUTuX2O79JFAeNgK7Sw7EQ,255
|
50
|
+
rclone_api-1.3.28.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
|
51
|
+
rclone_api-1.3.28.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|