python-chi 1.2.4__tar.gz → 1.2.6__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 (75) hide show
  1. python_chi-1.2.6/AUTHORS +1 -0
  2. python_chi-1.2.6/ChangeLog +7 -0
  3. {python_chi-1.2.4 → python_chi-1.2.6}/PKG-INFO +1 -1
  4. {python_chi-1.2.4 → python_chi-1.2.6}/chi/container.py +1 -1
  5. {python_chi-1.2.4 → python_chi-1.2.6}/chi/hardware.py +4 -3
  6. {python_chi-1.2.4 → python_chi-1.2.6}/chi/lease.py +13 -6
  7. {python_chi-1.2.4 → python_chi-1.2.6}/chi/server.py +16 -9
  8. {python_chi-1.2.4 → python_chi-1.2.6}/python_chi.egg-info/PKG-INFO +1 -1
  9. python_chi-1.2.6/python_chi.egg-info/pbr.json +1 -0
  10. python_chi-1.2.6/setup.py +5 -0
  11. python_chi-1.2.4/AUTHORS +0 -1
  12. python_chi-1.2.4/ChangeLog +0 -7
  13. python_chi-1.2.4/python_chi.egg-info/pbr.json +0 -1
  14. python_chi-1.2.4/setup.py +0 -5
  15. {python_chi-1.2.4 → python_chi-1.2.6}/.github/CODEOWNERS +0 -0
  16. {python_chi-1.2.4 → python_chi-1.2.6}/.github/workflows/linting.yml +0 -0
  17. {python_chi-1.2.4 → python_chi-1.2.6}/.github/workflows/pypi-publish.yml +0 -0
  18. {python_chi-1.2.4 → python_chi-1.2.6}/.github/workflows/test.yml +0 -0
  19. {python_chi-1.2.4 → python_chi-1.2.6}/.mailmap +0 -0
  20. {python_chi-1.2.4 → python_chi-1.2.6}/.readthedocs.yml +0 -0
  21. {python_chi-1.2.4 → python_chi-1.2.6}/DEVELOPMENT.rst +0 -0
  22. {python_chi-1.2.4 → python_chi-1.2.6}/LICENSE +0 -0
  23. {python_chi-1.2.4 → python_chi-1.2.6}/Makefile +0 -0
  24. {python_chi-1.2.4 → python_chi-1.2.6}/README.rst +0 -0
  25. {python_chi-1.2.4 → python_chi-1.2.6}/chi/__init__.py +0 -0
  26. {python_chi-1.2.4 → python_chi-1.2.6}/chi/clients.py +0 -0
  27. {python_chi-1.2.4 → python_chi-1.2.6}/chi/context.py +0 -0
  28. {python_chi-1.2.4 → python_chi-1.2.6}/chi/exception.py +0 -0
  29. {python_chi-1.2.4 → python_chi-1.2.6}/chi/image.py +0 -0
  30. {python_chi-1.2.4 → python_chi-1.2.6}/chi/jupyterhub.py +0 -0
  31. {python_chi-1.2.4 → python_chi-1.2.6}/chi/keypair.py +0 -0
  32. {python_chi-1.2.4 → python_chi-1.2.6}/chi/magic.py +0 -0
  33. {python_chi-1.2.4 → python_chi-1.2.6}/chi/network.py +0 -0
  34. {python_chi-1.2.4 → python_chi-1.2.6}/chi/share.py +0 -0
  35. {python_chi-1.2.4 → python_chi-1.2.6}/chi/ssh.py +0 -0
  36. {python_chi-1.2.4 → python_chi-1.2.6}/chi/storage.py +0 -0
  37. {python_chi-1.2.4 → python_chi-1.2.6}/chi/util.py +0 -0
  38. {python_chi-1.2.4 → python_chi-1.2.6}/docs/__init__.py +0 -0
  39. {python_chi-1.2.4 → python_chi-1.2.6}/docs/_templates/page.html +0 -0
  40. {python_chi-1.2.4 → python_chi-1.2.6}/docs/conf.py +0 -0
  41. {python_chi-1.2.4 → python_chi-1.2.6}/docs/examples.rst +0 -0
  42. {python_chi-1.2.4 → python_chi-1.2.6}/docs/generate_notebook.py +0 -0
  43. {python_chi-1.2.4 → python_chi-1.2.6}/docs/index.rst +0 -0
  44. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/clients.rst +0 -0
  45. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/container.rst +0 -0
  46. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/context.rst +0 -0
  47. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/exception.rst +0 -0
  48. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/hardware.rst +0 -0
  49. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/image.rst +0 -0
  50. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/lease.rst +0 -0
  51. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/magic.rst +0 -0
  52. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/network.rst +0 -0
  53. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/server.rst +0 -0
  54. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/share.rst +0 -0
  55. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/ssh.rst +0 -0
  56. {python_chi-1.2.4 → python_chi-1.2.6}/docs/modules/storage.rst +0 -0
  57. {python_chi-1.2.4 → python_chi-1.2.6}/docs/requirements.txt +0 -0
  58. {python_chi-1.2.4 → python_chi-1.2.6}/python_chi.egg-info/SOURCES.txt +0 -0
  59. {python_chi-1.2.4 → python_chi-1.2.6}/python_chi.egg-info/dependency_links.txt +0 -0
  60. {python_chi-1.2.4 → python_chi-1.2.6}/python_chi.egg-info/not-zip-safe +0 -0
  61. {python_chi-1.2.4 → python_chi-1.2.6}/python_chi.egg-info/requires.txt +0 -0
  62. {python_chi-1.2.4 → python_chi-1.2.6}/python_chi.egg-info/top_level.txt +0 -0
  63. {python_chi-1.2.4 → python_chi-1.2.6}/requirements.txt +0 -0
  64. {python_chi-1.2.4 → python_chi-1.2.6}/ruff.toml +0 -0
  65. {python_chi-1.2.4 → python_chi-1.2.6}/setup.cfg +0 -0
  66. {python_chi-1.2.4 → python_chi-1.2.6}/test-requirements.txt +0 -0
  67. {python_chi-1.2.4 → python_chi-1.2.6}/tests/__init__.py +0 -0
  68. {python_chi-1.2.4 → python_chi-1.2.6}/tests/test_container.py +0 -0
  69. {python_chi-1.2.4 → python_chi-1.2.6}/tests/test_context.py +0 -0
  70. {python_chi-1.2.4 → python_chi-1.2.6}/tests/test_lease.py +0 -0
  71. {python_chi-1.2.4 → python_chi-1.2.6}/tests/test_network.py +0 -0
  72. {python_chi-1.2.4 → python_chi-1.2.6}/tests/test_server.py +0 -0
  73. {python_chi-1.2.4 → python_chi-1.2.6}/tests/test_share.py +0 -0
  74. {python_chi-1.2.4 → python_chi-1.2.6}/tests/test_ssh.py +0 -0
  75. {python_chi-1.2.4 → python_chi-1.2.6}/tox.ini +0 -0
@@ -0,0 +1 @@
1
+ Mark Powers <markpowers@uchicago.edu>
@@ -0,0 +1,7 @@
1
+ CHANGES
2
+ =======
3
+
4
+ v1.2.6
5
+ ------
6
+
7
+ * Kvm improvments (#90)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-chi
3
- Version: 1.2.4
3
+ Version: 1.2.6
4
4
  Summary: Helper library for Chameleon Infrastructure (CHI) testbed
5
5
  Home-page: https://www.chameleoncloud.org
6
6
  Author: University of Chicago
@@ -70,7 +70,7 @@ class Container:
70
70
  self,
71
71
  name: str,
72
72
  image_ref: str,
73
- exposed_ports: List[str],
73
+ exposed_ports: List[str] = None,
74
74
  reservation_id: str = None,
75
75
  start: bool = True,
76
76
  start_timeout: int = 0,
@@ -390,14 +390,15 @@ def show_nodes(nodes: Optional[List[Node]] = None) -> None:
390
390
 
391
391
  rows = []
392
392
  for n in nodes:
393
+ fixed_gpu = {} if not n.gpu or isinstance(n.gpu, list) else n.gpu
393
394
  rows.append(
394
395
  {
395
396
  "Node Name": n.name,
396
397
  "Type": n.type,
397
- "Clock Speed (GHz)": round(n.cpu.get("clock_speed", 0) / 1e9, 2),
398
+ "Clock Speed (GHz)": round((n.cpu.get("clock_speed") or 0) / 1e9, 2),
398
399
  "RAM": n.main_memory.get("humanized_ram_size", "N/A"),
399
- "GPU Model": (n.gpu or {}).get("gpu_model") or "",
400
- "GPU Count": (n.gpu or {}).get("gpu_count") or "",
400
+ "GPU Model": fixed_gpu.get("gpu_model") or "",
401
+ "GPU Count": fixed_gpu.get("gpu_count") or "",
401
402
  "Storage Size": n.storage_devices[0].get("humanized_size", "N/A")
402
403
  if n.storage_devices
403
404
  else "N/A",
@@ -484,14 +484,23 @@ class Lease:
484
484
  """
485
485
  add_fip_reservation(reservation_list=self.fip_reservations, count=amount)
486
486
 
487
- def add_flavor_reservation(self, id, amount=1):
487
+ def add_flavor_reservation(self, id=None, name=None, amount=1):
488
488
  """
489
- Add a reservation for a KVM flavor to the list of reservations.
489
+ Add a reservation for a KVM flavor to the list of reservations by name or ID.
490
490
 
491
491
  Args:
492
492
  id (str): The ID of the flavor to reserve
493
- count (int): The number of floating IPs to reserve.
493
+ name (str): The name of the flavor to reserve
494
+ amount (int): The number of instances of this flavor to reserve
494
495
  """
496
+ # Do not permit both or neither name and id.
497
+ if (name and id) or not (name or id):
498
+ raise CHIValueError("You must specify exactly one of id or name")
499
+
500
+ # Blazar API requires flavor ID, so we must convert from name
501
+ if not id:
502
+ id = server.get_flavor(name).id
503
+
495
504
  self.flavor_reservations.append(
496
505
  {
497
506
  "resource_type": "flavor:instance",
@@ -783,9 +792,7 @@ class Lease:
783
792
  """
784
793
  flavors = []
785
794
  for res in self.flavor_reservations:
786
- flavors.extend(
787
- server.list_flavors(reservable=True, reservation_id=res.get("id"))
788
- )
795
+ flavors.extend(server.list_flavors(reservation_id=res.get("id")))
789
796
  return flavors
790
797
 
791
798
 
@@ -699,11 +699,12 @@ class Flavor:
699
699
  return f"<{self.__class__.__name__} '{self.name}' {self.description} (disk={self.disk}) (ram={self.ram}) (vcpus={self.vcpus})>"
700
700
 
701
701
 
702
- def list_flavors(reservable=None, reservation_id=None) -> List[Flavor]:
703
- """Get a list of all available flavors.
702
+ def list_flavors(reservable=None, gpu=None, reservation_id=None) -> List[Flavor]:
703
+ """Get a list of flavors
704
704
 
705
705
  Args:
706
- reservable (bool): Whether to filter by reservable flavors. Defaults to True.
706
+ reservable (bool): If given, whether to filter by reservable flavors.
707
+ gpu (bool): If given, whether to filter by GPU flavors.
707
708
  reservation_id (str, optional): The reservation ID to filter by. Defaults to None.
708
709
 
709
710
  Returns:
@@ -715,13 +716,19 @@ def list_flavors(reservable=None, reservation_id=None) -> List[Flavor]:
715
716
  chi_flavors = []
716
717
  for f in flavors:
717
718
  extras = f.get_keys()
718
- # include a flavor if:
719
- # - not filtering by reservable
720
- # - is reservable in blazar & not an active reservation flavor
721
- if not reservable or (
722
- extras.get("aggregate_instance_extra_specs:reservation")
719
+ is_reservable = not any(
720
+ e.startswith("resources:CUSTOM_RESERVATION_") for e in extras
721
+ )
722
+ is_gpu = f.extra_specs.get("trait:CUSTOM_GPU") == "required"
723
+ matching_reservation = (
724
+ reservation_id is None
725
+ or extras.get("aggregate_instance_extra_specs:reservation", None)
723
726
  == reservation_id
724
- and extras.get("trait:CUSTOM_BLAZAR_FLAVOR_RESERVATION") == "required"
727
+ )
728
+ if (
729
+ (reservable is None or reservable == is_reservable)
730
+ and (gpu is None or gpu == is_gpu)
731
+ and matching_reservation
725
732
  ):
726
733
  chi_flavors.append(
727
734
  Flavor(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-chi
3
- Version: 1.2.4
3
+ Version: 1.2.6
4
4
  Summary: Helper library for Chameleon Infrastructure (CHI) testbed
5
5
  Home-page: https://www.chameleoncloud.org
6
6
  Author: University of Chicago
@@ -0,0 +1 @@
1
+ {"git_version": "f691d6a", "is_release": false}
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env python
2
+
3
+ from setuptools import setup
4
+
5
+ setup(setup_requires=["pbr"], pbr=True, version="v1.2.6")
python_chi-1.2.4/AUTHORS DELETED
@@ -1 +0,0 @@
1
- Rohan Babbar <rohanbabbar0408@yahoo.com>
@@ -1,7 +0,0 @@
1
- CHANGES
2
- =======
3
-
4
- v1.2.4
5
- ------
6
-
7
- * Fix condition with usage\_type and stitch provider (#89)
@@ -1 +0,0 @@
1
- {"git_version": "a25c884", "is_release": false}
python_chi-1.2.4/setup.py DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env python
2
-
3
- from setuptools import setup
4
-
5
- setup(setup_requires=["pbr"], pbr=True, version="v1.2.4")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes