rclone-api 1.1.40__py2.py3-none-any.whl → 1.1.41__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.
@@ -103,6 +103,53 @@ def _init() -> None:
103
103
  os.environ["RCLONE_API_VERBOSE"] = "1"
104
104
 
105
105
 
106
+ def _run_profile(rclone: Rclone, src_file: str, transfers: int, size: int) -> None:
107
+ mount_log = Path("logs") / "mount" / f"mount_{size}_{transfers}.log"
108
+ print("\n\n")
109
+ print("#" * 80)
110
+ print(f"# Started test download of {SizeSuffix(size)} with {transfers} transfers")
111
+ print("#" * 80)
112
+ net_io_start = psutil.net_io_counters()
113
+ start = time.time()
114
+ bytes_or_err: bytes | Exception = rclone.copy_bytes(
115
+ src=src_file,
116
+ offset=0,
117
+ length=size,
118
+ direct_io=True,
119
+ transfers=transfers,
120
+ mount_log=mount_log,
121
+ )
122
+ diff = time.time() - start
123
+ net_io_end = psutil.net_io_counters()
124
+ if isinstance(bytes_or_err, Exception):
125
+ print(bytes_or_err)
126
+ stack_trace = bytes_or_err.__traceback__
127
+ assert False, f"Error: {bytes_or_err}\nStack trace:\n{stack_trace}"
128
+ assert isinstance(bytes_or_err, bytes)
129
+ # self.assertEqual(len(bytes_or_err), size)
130
+ assert len(bytes_or_err) == size, f"Length: {len(bytes_or_err)} != {size}"
131
+
132
+ # print io stats
133
+ bytes_sent = net_io_end.bytes_sent - net_io_start.bytes_sent
134
+ bytes_recv = net_io_end.bytes_recv - net_io_start.bytes_recv
135
+ packets_sent = net_io_end.packets_sent - net_io_start.packets_sent
136
+ efficiency = size / (bytes_recv)
137
+ efficiency_100 = efficiency * 100
138
+ efficiency_str = f"{efficiency_100:.2f}"
139
+
140
+ bytes_send_suffix = SizeSuffix(bytes_sent)
141
+ bytes_recv_suffix = SizeSuffix(bytes_recv)
142
+ range_size = SizeSuffix(size)
143
+
144
+ print(f"\nFinished downloading {range_size} with {transfers} transfers")
145
+ print("Net IO stats:")
146
+ print(f"Bytes sent: {bytes_send_suffix}")
147
+ print(f"Bytes received: {bytes_recv_suffix}")
148
+ print(f"Packets sent: {packets_sent}")
149
+ print(f"Efficiency: {efficiency_str}%")
150
+ print(f"Time: {diff:.1f} seconds")
151
+
152
+
106
153
  def test_profile_copy_bytes() -> None:
107
154
  print("Running test_profile_copy_bytes")
108
155
  config, creds = _generate_rclone_config()
@@ -130,53 +177,9 @@ def test_profile_copy_bytes() -> None:
130
177
 
131
178
  for size in sizes:
132
179
  for transfers in transfer_list:
133
- mount_log = Path("logs") / "mount" / f"mount_{size}_{transfers}.log"
134
- print("\n\n")
135
- print("#" * 80)
136
- print(
137
- f"# Started test download of {SizeSuffix(size)} with {transfers} transfers"
180
+ _run_profile(
181
+ rclone=rclone, src_file=src_file, transfers=transfers, size=size
138
182
  )
139
- print("#" * 80)
140
- net_io_start = psutil.net_io_counters()
141
- start = time.time()
142
- bytes_or_err: bytes | Exception = rclone.copy_bytes(
143
- src=src_file,
144
- offset=0,
145
- length=size,
146
- direct_io=True,
147
- transfers=transfers,
148
- mount_log=mount_log,
149
- )
150
- diff = time.time() - start
151
- net_io_end = psutil.net_io_counters()
152
- if isinstance(bytes_or_err, Exception):
153
- print(bytes_or_err)
154
- stack_trace = bytes_or_err.__traceback__
155
- assert False, f"Error: {bytes_or_err}\nStack trace:\n{stack_trace}"
156
- assert isinstance(bytes_or_err, bytes)
157
- # self.assertEqual(len(bytes_or_err), size)
158
- assert len(bytes_or_err) == size, f"Length: {len(bytes_or_err)} != {size}"
159
-
160
- # print io stats
161
- bytes_sent = net_io_end.bytes_sent - net_io_start.bytes_sent
162
- bytes_recv = net_io_end.bytes_recv - net_io_start.bytes_recv
163
- packets_sent = net_io_end.packets_sent - net_io_start.packets_sent
164
- efficiency = size / (bytes_recv)
165
- efficiency_100 = efficiency * 100
166
- efficiency_str = f"{efficiency_100:.2f}"
167
-
168
- bytes_send_suffix = SizeSuffix(bytes_sent)
169
- bytes_recv_suffix = SizeSuffix(bytes_recv)
170
- range_size = SizeSuffix(size)
171
-
172
- print(f"\nFinished downloading {range_size} with {transfers} transfers")
173
- print("Net IO stats:")
174
- print(f"Bytes sent: {bytes_send_suffix}")
175
- print(f"Bytes received: {bytes_recv_suffix}")
176
- print(f"Packets sent: {packets_sent}")
177
- print(f"Efficiency: {efficiency_str}%")
178
- print(f"Time: {diff:.1f} seconds")
179
-
180
183
  print("done")
181
184
 
182
185
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.1.40
3
+ Version: 1.1.41
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,7 +25,7 @@ rclone_api/cmd/copy_large_s3.py,sha256=-rfedi-ZzPUdCSP8ai9LRL0y1xVkvN-viQQlk8HVU
25
25
  rclone_api/cmd/list_files.py,sha256=x8FHODEilwKqwdiU1jdkeJbLwOqUkUQuDWPo2u_zpf0,741
26
26
  rclone_api/experimental/flags.py,sha256=qCVD--fSTmzlk9hloRLr0q9elzAOFzPsvVpKM3aB1Mk,2739
27
27
  rclone_api/experimental/flags_base.py,sha256=ajU_czkTcAxXYU-SlmiCfHY7aCQGHvpCLqJ-Z8uZLk0,2102
28
- rclone_api/profile/mount_copy_bytes.py,sha256=B9Nav9JOTh9u37Al0kBCAkWY8Vns1WDmw1bqz4z9H6k,5800
28
+ rclone_api/profile/mount_copy_bytes.py,sha256=E3mYyuYdBzFwDrdMv2IMO2G8pXbiEEixmcle4_6-a4Q,5648
29
29
  rclone_api/s3/api.py,sha256=qxtRDUpHYqJ7StJRtP8U_PbF_BvYRg705568SyvF-R0,3770
30
30
  rclone_api/s3/basic_ops.py,sha256=hK3366xhVEzEcjz9Gk_8lFx6MRceAk72cax6mUrr6ko,2104
31
31
  rclone_api/s3/chunk_file.py,sha256=YELR-EzR7RHpzCDGpYdzlwu21NZW5wttIDvLoONI4aU,3477
@@ -33,9 +33,9 @@ rclone_api/s3/chunk_types.py,sha256=LbXayXY1KgVU1LkdbASD_BQ7TpVpwVnzMjtz--8LBaE,
33
33
  rclone_api/s3/create.py,sha256=wgfkapv_j904CfKuWyiBIWJVxfAx_ftemFSUV14aT68,3149
34
34
  rclone_api/s3/types.py,sha256=yBnJ38Tjk6RlydJ-sqZ7DSfyFloy8KDYJ0mv3vlOzLE,1388
35
35
  rclone_api/s3/upload_file_multipart.py,sha256=1jQAdk35Fa9Tcq36bS65262cs7AcNG2DAFQ-NdYlWSw,9961
36
- rclone_api-1.1.40.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
37
- rclone_api-1.1.40.dist-info/METADATA,sha256=OeyCLNTO1fipD4oBMmGPb86uF8bkeMYSWfn-rZGIzF0,4537
38
- rclone_api-1.1.40.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
39
- rclone_api-1.1.40.dist-info/entry_points.txt,sha256=TV8kwP3FRzYwUEr0RLC7aJh0W03SAefIJNXTJ-FdMIQ,200
40
- rclone_api-1.1.40.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
41
- rclone_api-1.1.40.dist-info/RECORD,,
36
+ rclone_api-1.1.41.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
37
+ rclone_api-1.1.41.dist-info/METADATA,sha256=mx3QT0C9Jf3sRbD8zgSC4WCvIyAhtxBOuKT4P9Wx9ZI,4537
38
+ rclone_api-1.1.41.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
39
+ rclone_api-1.1.41.dist-info/entry_points.txt,sha256=TV8kwP3FRzYwUEr0RLC7aJh0W03SAefIJNXTJ-FdMIQ,200
40
+ rclone_api-1.1.41.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
41
+ rclone_api-1.1.41.dist-info/RECORD,,