rclone-api 1.0.100__py2.py3-none-any.whl → 1.1.1__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.
@@ -295,22 +295,23 @@ def file_chunker(
295
295
  chunk_size = upload_info.chunk_size
296
296
  src = Path(file_path)
297
297
  # Mounted files may take a while to appear, so keep retrying.
298
- file_size = _get_file_size(src, timeout=60)
299
- part_number = 1
300
- done_part_numbers: set[int] = {
301
- p.part_number for p in upload_state.parts if p is not None
302
- }
303
- num_parts = upload_info.total_chunks()
304
-
305
- def next_part_number() -> int | None:
306
- nonlocal part_number
307
- while part_number in done_part_numbers:
308
- part_number += 1
309
- if part_number > num_parts:
310
- return None
311
- return part_number
312
298
 
313
299
  try:
300
+ file_size = _get_file_size(src, timeout=60)
301
+ part_number = 1
302
+ done_part_numbers: set[int] = {
303
+ p.part_number for p in upload_state.parts if p is not None
304
+ }
305
+ num_parts = upload_info.total_chunks()
306
+
307
+ def next_part_number() -> int | None:
308
+ nonlocal part_number
309
+ while part_number in done_part_numbers:
310
+ part_number += 1
311
+ if part_number > num_parts:
312
+ return None
313
+ return part_number
314
+
314
315
  while not should_stop():
315
316
  curr_parth_num = next_part_number()
316
317
  if curr_parth_num is None:
@@ -491,16 +492,20 @@ def upload_file_multipart(
491
492
  upload_info = upload_state.upload_info
492
493
  max_workers = 8
493
494
 
495
+ chunker_errors: Queue[Exception] = Queue()
496
+
494
497
  def chunker_task(
495
498
  upload_state=upload_state,
496
499
  output=filechunks,
497
500
  max_chunks=max_chunks_before_suspension,
501
+ queue_errors=chunker_errors,
498
502
  ) -> None:
499
503
  try:
500
504
  file_chunker(
501
505
  upload_state=upload_state, output=output, max_chunks=max_chunks
502
506
  )
503
- except Exception:
507
+ except Exception as e:
508
+ queue_errors.put(e)
504
509
  _thread.interrupt_main()
505
510
  raise
506
511
 
@@ -532,6 +537,9 @@ def upload_file_multipart(
532
537
  # upload_state.finished_parts.put(None) # Signal the end of the queue
533
538
  upload_state.add_finished(None)
534
539
  thread_chunker.join()
540
+
541
+ if not chunker_errors.empty():
542
+ raise chunker_errors.get()
535
543
  if not upload_state.is_done():
536
544
  upload_state.save()
537
545
  return MultiUploadResult.SUSPENDED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.100
3
+ Version: 1.1.1
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  License: BSD 3-Clause License
@@ -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=-GzafZ93Mm9go7BqOaq8svPsjAwtFbVuzVpFdtw8cVA,18283
28
+ rclone_api/s3/chunk_uploader.py,sha256=JpVuCzr2Ox0bjXAyFCqQX2ctJCAId-Ttkr4E7HyWJRc,18537
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.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,,
31
+ rclone_api-1.1.1.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
32
+ rclone_api-1.1.1.dist-info/METADATA,sha256=mGHPhrp3mLNT_R8N1BjY8PTChqNViAAaaJYK8DNReHE,4478
33
+ rclone_api-1.1.1.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
34
+ rclone_api-1.1.1.dist-info/entry_points.txt,sha256=6eNqTRXKhVf8CpWNjXiOa_0Du9tHiW_HD2iQSXRsUg8,132
35
+ rclone_api-1.1.1.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
36
+ rclone_api-1.1.1.dist-info/RECORD,,