rclone-api 1.3.26__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/types.py +15 -17
- {rclone_api-1.3.26.dist-info → rclone_api-1.3.28.dist-info}/METADATA +1 -1
- {rclone_api-1.3.26.dist-info → rclone_api-1.3.28.dist-info}/RECORD +9 -8
- {rclone_api-1.3.26.dist-info → rclone_api-1.3.28.dist-info}/LICENSE +0 -0
- {rclone_api-1.3.26.dist-info → rclone_api-1.3.28.dist-info}/WHEEL +0 -0
- {rclone_api-1.3.26.dist-info → rclone_api-1.3.28.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.3.26.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()
|
rclone_api/types.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
import atexit
|
2
2
|
import os
|
3
3
|
import re
|
4
|
+
import threading
|
4
5
|
import time
|
5
6
|
import warnings
|
6
7
|
from dataclasses import dataclass
|
7
8
|
from enum import Enum
|
8
9
|
from pathlib import Path
|
9
|
-
from threading import Lock
|
10
|
+
from threading import Lock
|
10
11
|
from typing import Any
|
11
12
|
|
12
13
|
|
@@ -291,35 +292,32 @@ atexit.register(_on_exit_cleanup)
|
|
291
292
|
_FILEPARTS: list["FilePart"] = []
|
292
293
|
|
293
294
|
_FILEPARTS_LOCK = Lock()
|
295
|
+
|
296
|
+
|
294
297
|
def _add_filepart(part: "FilePart") -> None:
|
295
298
|
with _FILEPARTS_LOCK:
|
296
299
|
if part not in _FILEPARTS:
|
297
300
|
_FILEPARTS.append(part)
|
298
301
|
|
302
|
+
|
299
303
|
def _remove_filepart(part: "FilePart") -> None:
|
300
304
|
with _FILEPARTS_LOCK:
|
301
305
|
if part in _FILEPARTS:
|
302
306
|
_FILEPARTS.remove(part)
|
303
307
|
|
304
308
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
print("File parts:")
|
314
|
-
for part in _FILEPARTS:
|
315
|
-
print(part)
|
316
|
-
print(part.stacktrace)
|
317
|
-
print("\n")
|
318
|
-
print("\n\n")
|
319
|
-
time.sleep(5)
|
309
|
+
def run_debug_parts():
|
310
|
+
while True:
|
311
|
+
print("\nAlive file parts:")
|
312
|
+
for part in list(_FILEPARTS):
|
313
|
+
print(part)
|
314
|
+
# print(part.stacktrace)
|
315
|
+
print("\n\n")
|
316
|
+
time.sleep(60)
|
320
317
|
|
321
318
|
|
322
|
-
dbg_thread =
|
319
|
+
dbg_thread = threading.Thread(target=run_debug_parts)
|
320
|
+
dbg_thread.start()
|
323
321
|
|
324
322
|
|
325
323
|
class FilePart:
|
@@ -21,7 +21,7 @@ rclone_api/rclone.py,sha256=yRhQoCBJI-tfhxySR17a-vSEhWw5cMbk8_WbYs5WqRc,54117
|
|
21
21
|
rclone_api/remote.py,sha256=jq3dPbAGvYZFW5cTviqxT2w6_jG2LLfS1RIcYSmMsQQ,503
|
22
22
|
rclone_api/rpath.py,sha256=8ZA_1wxWtskwcy0I8V2VbjKDmzPkiWd8Q2JQSvh-sYE,2586
|
23
23
|
rclone_api/scan_missing_folders.py,sha256=Kulca2Q6WZodt00ATFHkmqqInuoPvBkhTcS9703y6po,4740
|
24
|
-
rclone_api/types.py,sha256=
|
24
|
+
rclone_api/types.py,sha256=ous70ea5oEs0gz0KLCWfimVyF0_fgrXRA8e0_HLk8nk,12301
|
25
25
|
rclone_api/util.py,sha256=F9Q3zbWRsgPF4NG6OWB63cZ7GVq82lsraP47gmmDohU,5416
|
26
26
|
rclone_api/walk.py,sha256=-54NVE8EJcCstwDoaC_UtHm73R2HrZwVwQmsnv55xNU,3369
|
27
27
|
rclone_api/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
|
@@ -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
|