rclone-api 1.1.40__py2.py3-none-any.whl → 1.1.42__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,55 @@ 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 = (
108
+ Path("logs") / "mount" / f"mount_{SizeSuffix(size)}_threads_{transfers}.log"
109
+ )
110
+ print("\n\n")
111
+ print("#" * 80)
112
+ print(f"# Started test download of {SizeSuffix(size)} with {transfers} transfers")
113
+ print("#" * 80)
114
+ net_io_start = psutil.net_io_counters()
115
+ start = time.time()
116
+ bytes_or_err: bytes | Exception = rclone.copy_bytes(
117
+ src=src_file,
118
+ offset=0,
119
+ length=size,
120
+ direct_io=True,
121
+ transfers=transfers,
122
+ mount_log=mount_log,
123
+ )
124
+ diff = time.time() - start
125
+ net_io_end = psutil.net_io_counters()
126
+ if isinstance(bytes_or_err, Exception):
127
+ print(bytes_or_err)
128
+ stack_trace = bytes_or_err.__traceback__
129
+ assert False, f"Error: {bytes_or_err}\nStack trace:\n{stack_trace}"
130
+ assert isinstance(bytes_or_err, bytes)
131
+ # self.assertEqual(len(bytes_or_err), size)
132
+ assert len(bytes_or_err) == size, f"Length: {len(bytes_or_err)} != {size}"
133
+
134
+ # print io stats
135
+ bytes_sent = net_io_end.bytes_sent - net_io_start.bytes_sent
136
+ bytes_recv = net_io_end.bytes_recv - net_io_start.bytes_recv
137
+ packets_sent = net_io_end.packets_sent - net_io_start.packets_sent
138
+ efficiency = size / (bytes_recv)
139
+ efficiency_100 = efficiency * 100
140
+ efficiency_str = f"{efficiency_100:.2f}"
141
+
142
+ bytes_send_suffix = SizeSuffix(bytes_sent)
143
+ bytes_recv_suffix = SizeSuffix(bytes_recv)
144
+ range_size = SizeSuffix(size)
145
+
146
+ print(f"\nFinished downloading {range_size} with {transfers} transfers")
147
+ print("Net IO stats:")
148
+ print(f"Bytes sent: {bytes_send_suffix}")
149
+ print(f"Bytes received: {bytes_recv_suffix}")
150
+ print(f"Packets sent: {packets_sent}")
151
+ print(f"Efficiency: {efficiency_str}%")
152
+ print(f"Time: {diff:.1f} seconds")
153
+
154
+
106
155
  def test_profile_copy_bytes() -> None:
107
156
  print("Running test_profile_copy_bytes")
108
157
  config, creds = _generate_rclone_config()
@@ -130,53 +179,9 @@ def test_profile_copy_bytes() -> None:
130
179
 
131
180
  for size in sizes:
132
181
  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"
138
- )
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,
182
+ _run_profile(
183
+ rclone=rclone, src_file=src_file, transfers=transfers, size=size
149
184
  )
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
185
  print("done")
181
186
 
182
187
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.1.40
3
+ Version: 1.1.42
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=Jsvb49CNTvkdSAkIAKDxBJ5TzAk7-dOuZdDrigiTjsY,5684
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.42.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
37
+ rclone_api-1.1.42.dist-info/METADATA,sha256=vIQ6apt1qDwDIAosms80GILhpDxFHYoR1J4jtPdshCU,4537
38
+ rclone_api-1.1.42.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
39
+ rclone_api-1.1.42.dist-info/entry_points.txt,sha256=TV8kwP3FRzYwUEr0RLC7aJh0W03SAefIJNXTJ-FdMIQ,200
40
+ rclone_api-1.1.42.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
41
+ rclone_api-1.1.42.dist-info/RECORD,,