cloud-files 6.1.2__tar.gz → 6.2.0__tar.gz

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.
Files changed (39) hide show
  1. {cloud_files-6.1.2 → cloud_files-6.2.0}/ChangeLog +13 -0
  2. {cloud_files-6.1.2 → cloud_files-6.2.0}/PKG-INFO +1 -1
  3. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloud_files.egg-info/PKG-INFO +1 -1
  4. cloud_files-6.2.0/cloud_files.egg-info/pbr.json +1 -0
  5. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/interfaces.py +1 -0
  6. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/paths.py +12 -0
  7. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles_cli/cloudfiles_cli.py +81 -5
  8. cloud_files-6.1.2/cloud_files.egg-info/pbr.json +0 -1
  9. {cloud_files-6.1.2 → cloud_files-6.2.0}/.github/workflows/test-suite.yml +0 -0
  10. {cloud_files-6.1.2 → cloud_files-6.2.0}/AUTHORS +0 -0
  11. {cloud_files-6.1.2 → cloud_files-6.2.0}/LICENSE +0 -0
  12. {cloud_files-6.1.2 → cloud_files-6.2.0}/MANIFEST.in +0 -0
  13. {cloud_files-6.1.2 → cloud_files-6.2.0}/README.md +0 -0
  14. {cloud_files-6.1.2 → cloud_files-6.2.0}/automated_test.py +0 -0
  15. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloud_files.egg-info/SOURCES.txt +0 -0
  16. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloud_files.egg-info/dependency_links.txt +0 -0
  17. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloud_files.egg-info/entry_points.txt +0 -0
  18. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloud_files.egg-info/not-zip-safe +0 -0
  19. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloud_files.egg-info/requires.txt +0 -0
  20. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloud_files.egg-info/top_level.txt +0 -0
  21. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/__init__.py +0 -0
  22. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/cloudfiles.py +0 -0
  23. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/compression.py +0 -0
  24. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/connectionpools.py +0 -0
  25. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/exceptions.py +0 -0
  26. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/gcs.py +0 -0
  27. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/lib.py +0 -0
  28. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/monitoring.py +0 -0
  29. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/resumable_tools.py +0 -0
  30. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/scheduler.py +0 -0
  31. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/secrets.py +0 -0
  32. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/test.py +0 -0
  33. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/threaded_queue.py +0 -0
  34. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles/typing.py +0 -0
  35. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles_cli/LICENSE +0 -0
  36. {cloud_files-6.1.2 → cloud_files-6.2.0}/cloudfiles_cli/__init__.py +0 -0
  37. {cloud_files-6.1.2 → cloud_files-6.2.0}/requirements.txt +0 -0
  38. {cloud_files-6.1.2 → cloud_files-6.2.0}/setup.cfg +0 -0
  39. {cloud_files-6.1.2 → cloud_files-6.2.0}/setup.py +0 -0
@@ -1,6 +1,19 @@
1
1
  CHANGES
2
2
  =======
3
3
 
4
+ 6.2.0
5
+ -----
6
+
7
+ * feat: adds cloudfiles watch net print/histogram (#124)
8
+
9
+ 6.1.3
10
+ -----
11
+
12
+ * fix: du for single files was broken
13
+ * fix: use service provider
14
+ * feat: add "service\_provider" resolver
15
+ * fix: malformed provider/bucket groupings in rm
16
+
4
17
  6.1.2
5
18
  -----
6
19
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloud-files
3
- Version: 6.1.2
3
+ Version: 6.2.0
4
4
  Summary: Fast access to cloud storage and local FS.
5
5
  Home-page: https://github.com/seung-lab/cloud-files/
6
6
  Author: William Silversmith
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloud-files
3
- Version: 6.1.2
3
+ Version: 6.2.0
4
4
  Summary: Fast access to cloud storage and local FS.
5
5
  Home-page: https://github.com/seung-lab/cloud-files/
6
6
  Author: William Silversmith
@@ -0,0 +1 @@
1
+ {"git_version": "a0c3192", "is_release": true}
@@ -870,6 +870,7 @@ class GoogleCloudStorageInterface(StorageInterface):
870
870
  elif flat and '/' not in blob.name.removeprefix(path):
871
871
  yield filename
872
872
 
873
+
873
874
  @retry
874
875
  def subtree_size(self, prefix:str = "") -> tuple[int,int]:
875
876
  layer_path = self.get_path_to_file("")
@@ -229,6 +229,18 @@ def ascloudpath(epath):
229
229
  return f"{epath.format}://" + pth
230
230
  return pth
231
231
 
232
+ def service_provider(epath:ExtractedPath) -> str:
233
+ stack = [
234
+ epath.alias,
235
+ epath.protocol,
236
+ ]
237
+ while len(stack):
238
+ elem = stack.pop(0)
239
+ if elem is None:
240
+ continue
241
+ return elem
242
+ return None
243
+
232
244
  def asprotocolpath(epath):
233
245
  pth = ''
234
246
 
@@ -12,6 +12,7 @@ import os.path
12
12
  from tqdm import tqdm
13
13
  import shutil
14
14
  import sys
15
+ import time
15
16
 
16
17
  # Below two lines fix MacOS warning on
17
18
  # High Sierra and above when we are using
@@ -752,8 +753,8 @@ def _rm_singles(paths, progress, parallel, block_size):
752
753
  for path in paths:
753
754
  npath = normalize_path(path)
754
755
  extracted = cloudfiles.paths.extract(npath)
755
- normalized_protocol = cloudfiles.paths.asprotocolpath(extracted)
756
- cfgroups[(normalized_protocol, extracted.bucket)].append(extracted.path)
756
+ provider = cloudfiles.paths.service_provider(extracted)
757
+ cfgroups[(provider, extracted.bucket)].append(extracted.path)
757
758
 
758
759
  for group, paths in cfgroups.items():
759
760
  cfpath = f"{group[0]}://{group[1]}/"
@@ -807,16 +808,16 @@ def du(paths, grand_total, summarize, human_readable, count_files):
807
808
  """Display disk usage statistics."""
808
809
  results = []
809
810
 
810
- list_data = False
811
+ simplified_data = True
811
812
 
812
813
  for path in paths:
813
814
  npath = normalize_path(path)
814
815
  if ispathdir(path):
815
816
  cf = CloudFiles(npath)
816
817
  if summarize:
818
+ simplified_data = False
817
819
  results.append(cf.subtree_size())
818
820
  else:
819
- list_data = True
820
821
  results.append(cf.size(cf.list()))
821
822
  else:
822
823
  cf = CloudFiles(os.path.dirname(npath))
@@ -848,7 +849,7 @@ def du(paths, grand_total, summarize, human_readable, count_files):
848
849
  summary = {}
849
850
  num_files = 0
850
851
  for path, res in zip(paths, results):
851
- if list_data:
852
+ if simplified_data:
852
853
  summary[path] = sum(res.values())
853
854
  num_files += len(res)
854
855
  else:
@@ -1172,4 +1173,79 @@ def alias_rm(name):
1172
1173
  except KeyError:
1173
1174
  pass
1174
1175
 
1176
+ @main.group("watch")
1177
+ def iostatsgroup():
1178
+ """
1179
+ Monitor machine IO, print stats, and make histograms.
1180
+ """
1181
+ pass
1182
+
1183
+ @iostatsgroup.group("net")
1184
+ def iostats_net_group():
1185
+ """
1186
+ Find ethernet devices and monitor them.
1187
+ """
1188
+ pass
1189
+
1190
+
1191
+ @iostats_net_group.command("print")
1192
+ @click.option("--duration", type=float, default=0, show_default=True)
1193
+ @click.option("--interval", type=float, default=1, show_default=True)
1194
+ @click.option("--one-line", is_flag=True, default=False, show_default=True)
1195
+ def net_print(duration:float, interval:float, one_line:bool):
1196
+ """
1197
+ Print transmissions speeds.
1198
+ """
1199
+ network_sampler = IOSampler(
1200
+ buffer_sec=max(interval * 2, 1),
1201
+ interval=interval,
1202
+ )
1203
+ network_sampler.start_sampling()
1204
+
1205
+ def fmt(elapsed, rbps, tbps):
1206
+ return f"t={elapsed:1.1f}s | RX: {rbps/8e6:3.2f} MB/sec ({rbps/1e9:1.2f} Gbps) | TX: {tbps/8e6:3.2f} MB/sec ({tbps/1e9:1.2f} Gbps)"
1207
+
1208
+ ending = '\n' if not one_line else '\r'
1209
+
1210
+ s = time.perf_counter()
1211
+ try:
1212
+ while True:
1213
+ time.sleep(interval)
1214
+ rbps, tbps = network_sampler.current_bps()
1215
+ elapsed = time.perf_counter() - s
1216
+ display = fmt(elapsed, rbps, tbps)
1217
+ print(display, flush=True, end=ending)
1218
+
1219
+ if elapsed > duration and duration > 0:
1220
+ return
1221
+ except KeyboardInterrupt:
1222
+ pass
1223
+
1224
+ network_sampler.stop_sampling()
1225
+ rbps, tbps = network_sampler.current_bps()
1226
+ elapsed = time.perf_counter() - s
1227
+ display = fmt(elapsed, rbps, tbps)
1228
+ print(display, flush=True)
1229
+
1230
+ @iostats_net_group.command("histogram")
1231
+ @click.option("--duration", type=float, default=5, show_default=True)
1232
+ @click.option("--interval", type=float, default=1, show_default=True)
1233
+ @click.option("--filename", type=str, default="", show_default=True)
1234
+ def net_histogram(duration:float, interval:float, filename:str):
1235
+ """
1236
+ Produce a histogram of network speeds.
1237
+ """
1238
+ network_sampler = IOSampler(
1239
+ buffer_sec=max(duration * 2, 1),
1240
+ interval=interval,
1241
+ )
1242
+ network_sampler.start_sampling()
1243
+
1244
+ time.sleep(float(duration) + 0.1)
1245
+ network_sampler.stop_sampling()
1246
+
1247
+ if filename == "":
1248
+ filename = None
1249
+
1250
+ network_sampler.plot_histogram(filename=filename)
1175
1251
 
@@ -1 +0,0 @@
1
- {"git_version": "2d4d337", "is_release": true}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes