python-chi 1.0.7__tar.gz → 1.0.8__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 (70) hide show
  1. python_chi-1.0.8/ChangeLog +7 -0
  2. {python_chi-1.0.7 → python_chi-1.0.8}/PKG-INFO +1 -1
  3. {python_chi-1.0.7 → python_chi-1.0.8}/chi/hardware.py +23 -8
  4. {python_chi-1.0.7 → python_chi-1.0.8}/python_chi.egg-info/PKG-INFO +1 -1
  5. python_chi-1.0.8/python_chi.egg-info/pbr.json +1 -0
  6. {python_chi-1.0.7 → python_chi-1.0.8}/setup.py +1 -1
  7. python_chi-1.0.7/ChangeLog +0 -7
  8. python_chi-1.0.7/python_chi.egg-info/pbr.json +0 -1
  9. {python_chi-1.0.7 → python_chi-1.0.8}/.github/CODEOWNERS +0 -0
  10. {python_chi-1.0.7 → python_chi-1.0.8}/.github/workflows/pypi-publish.yml +0 -0
  11. {python_chi-1.0.7 → python_chi-1.0.8}/.github/workflows/test.yml +0 -0
  12. {python_chi-1.0.7 → python_chi-1.0.8}/.mailmap +0 -0
  13. {python_chi-1.0.7 → python_chi-1.0.8}/.readthedocs.yml +0 -0
  14. {python_chi-1.0.7 → python_chi-1.0.8}/AUTHORS +0 -0
  15. {python_chi-1.0.7 → python_chi-1.0.8}/DEVELOPMENT.rst +0 -0
  16. {python_chi-1.0.7 → python_chi-1.0.8}/LICENSE +0 -0
  17. {python_chi-1.0.7 → python_chi-1.0.8}/Makefile +0 -0
  18. {python_chi-1.0.7 → python_chi-1.0.8}/README.rst +0 -0
  19. {python_chi-1.0.7 → python_chi-1.0.8}/chi/__init__.py +0 -0
  20. {python_chi-1.0.7 → python_chi-1.0.8}/chi/clients.py +0 -0
  21. {python_chi-1.0.7 → python_chi-1.0.8}/chi/container.py +0 -0
  22. {python_chi-1.0.7 → python_chi-1.0.8}/chi/context.py +0 -0
  23. {python_chi-1.0.7 → python_chi-1.0.8}/chi/exception.py +0 -0
  24. {python_chi-1.0.7 → python_chi-1.0.8}/chi/image.py +0 -0
  25. {python_chi-1.0.7 → python_chi-1.0.8}/chi/jupyterhub.py +0 -0
  26. {python_chi-1.0.7 → python_chi-1.0.8}/chi/keypair.py +0 -0
  27. {python_chi-1.0.7 → python_chi-1.0.8}/chi/lease.py +0 -0
  28. {python_chi-1.0.7 → python_chi-1.0.8}/chi/magic.py +0 -0
  29. {python_chi-1.0.7 → python_chi-1.0.8}/chi/network.py +0 -0
  30. {python_chi-1.0.7 → python_chi-1.0.8}/chi/server.py +0 -0
  31. {python_chi-1.0.7 → python_chi-1.0.8}/chi/share.py +0 -0
  32. {python_chi-1.0.7 → python_chi-1.0.8}/chi/ssh.py +0 -0
  33. {python_chi-1.0.7 → python_chi-1.0.8}/chi/storage.py +0 -0
  34. {python_chi-1.0.7 → python_chi-1.0.8}/chi/util.py +0 -0
  35. {python_chi-1.0.7 → python_chi-1.0.8}/docs/__init__.py +0 -0
  36. {python_chi-1.0.7 → python_chi-1.0.8}/docs/conf.py +0 -0
  37. {python_chi-1.0.7 → python_chi-1.0.8}/docs/examples.rst +0 -0
  38. {python_chi-1.0.7 → python_chi-1.0.8}/docs/generate_notebook.py +0 -0
  39. {python_chi-1.0.7 → python_chi-1.0.8}/docs/index.rst +0 -0
  40. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/clients.rst +0 -0
  41. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/container.rst +0 -0
  42. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/context.rst +0 -0
  43. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/exception.rst +0 -0
  44. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/hardware.rst +0 -0
  45. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/image.rst +0 -0
  46. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/lease.rst +0 -0
  47. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/magic.rst +0 -0
  48. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/network.rst +0 -0
  49. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/server.rst +0 -0
  50. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/share.rst +0 -0
  51. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/ssh.rst +0 -0
  52. {python_chi-1.0.7 → python_chi-1.0.8}/docs/modules/storage.rst +0 -0
  53. {python_chi-1.0.7 → python_chi-1.0.8}/docs/requirements.txt +0 -0
  54. {python_chi-1.0.7 → python_chi-1.0.8}/python_chi.egg-info/SOURCES.txt +0 -0
  55. {python_chi-1.0.7 → python_chi-1.0.8}/python_chi.egg-info/dependency_links.txt +0 -0
  56. {python_chi-1.0.7 → python_chi-1.0.8}/python_chi.egg-info/not-zip-safe +0 -0
  57. {python_chi-1.0.7 → python_chi-1.0.8}/python_chi.egg-info/requires.txt +0 -0
  58. {python_chi-1.0.7 → python_chi-1.0.8}/python_chi.egg-info/top_level.txt +0 -0
  59. {python_chi-1.0.7 → python_chi-1.0.8}/requirements.txt +0 -0
  60. {python_chi-1.0.7 → python_chi-1.0.8}/setup.cfg +0 -0
  61. {python_chi-1.0.7 → python_chi-1.0.8}/test-requirements.txt +0 -0
  62. {python_chi-1.0.7 → python_chi-1.0.8}/tests/__init__.py +0 -0
  63. {python_chi-1.0.7 → python_chi-1.0.8}/tests/test_container.py +0 -0
  64. {python_chi-1.0.7 → python_chi-1.0.8}/tests/test_context.py +0 -0
  65. {python_chi-1.0.7 → python_chi-1.0.8}/tests/test_lease.py +0 -0
  66. {python_chi-1.0.7 → python_chi-1.0.8}/tests/test_network.py +0 -0
  67. {python_chi-1.0.7 → python_chi-1.0.8}/tests/test_server.py +0 -0
  68. {python_chi-1.0.7 → python_chi-1.0.8}/tests/test_share.py +0 -0
  69. {python_chi-1.0.7 → python_chi-1.0.8}/tests/test_ssh.py +0 -0
  70. {python_chi-1.0.7 → python_chi-1.0.8}/tox.ini +0 -0
@@ -0,0 +1,7 @@
1
+ CHANGES
2
+ =======
3
+
4
+ v1.0.8
5
+ ------
6
+
7
+ * Add Node.reservable field
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: python-chi
3
- Version: 1.0.7
3
+ Version: 1.0.8
4
4
  Summary: Helper library for Chameleon Infrastructure (CHI) testbed
5
5
  Home-page: https://www.chameleoncloud.org
6
6
  Author: University of Chicago
@@ -1,4 +1,5 @@
1
1
  from collections import defaultdict
2
+ from concurrent.futures import ThreadPoolExecutor
2
3
  from dataclasses import dataclass
3
4
  from datetime import datetime, timedelta, timezone
4
5
  from typing import List, Optional, Tuple
@@ -36,6 +37,7 @@ class Node:
36
37
  storage_devices: List[dict]
37
38
  uid: str
38
39
  version: str
40
+ reservable: bool
39
41
 
40
42
  def next_free_timeslot(
41
43
  self, minimum_hours: int = 1
@@ -140,20 +142,30 @@ def get_nodes(
140
142
  )
141
143
  continue
142
144
 
143
- endpoint = f"sites/{site.split('@')[1].lower()}/clusters/chameleon/nodes"
144
- data = _call_api(endpoint)
145
-
146
145
  allocations = defaultdict(list)
147
146
  reserved_now = set()
148
147
  blazarclient = blazar()
149
148
  now = datetime.now(timezone.utc)
149
+
150
+ endpoint = f"sites/{site.split('@')[1].lower()}/clusters/chameleon/nodes"
151
+
152
+ with ThreadPoolExecutor() as executor:
153
+ f1 = executor.submit(_call_api, endpoint)
154
+ f2 = executor.submit(blazarclient.host.list)
155
+ data = f1.result()
156
+ blazar_hosts = f2.result()
157
+
158
+ blazar_hosts_by_id = {}
159
+ for host in blazar_hosts:
160
+ blazar_hosts_by_id[host["id"]] = host
161
+ blazar_hosts_by_hypervisor_hostname = {}
162
+ for host in blazar_hosts:
163
+ blazar_hosts_by_hypervisor_hostname[host["hypervisor_hostname"]] = host
164
+
150
165
  if filter_reserved:
151
- hosts_by_id = {}
152
- for host in blazarclient.host.list():
153
- hosts_by_id[host["id"]] = host
154
166
  for resource in blazarclient.host.list_allocations():
155
167
  for allocation in resource["reservations"]:
156
- blazar_host = hosts_by_id.get(resource["resource_id"], None)
168
+ blazar_host = blazar_hosts_by_id.get(resource["resource_id"], None)
157
169
  if blazar_host:
158
170
  allocations[blazar_host["hypervisor_hostname"]].append(
159
171
  allocation
@@ -162,6 +174,7 @@ def get_nodes(
162
174
  reserved_now.add(blazar_host["hypervisor_hostname"])
163
175
 
164
176
  for node_data in data["items"]:
177
+ blazar_host = blazar_hosts_by_hypervisor_hostname.get(node_data.get("uid"), None)
165
178
  node = Node(
166
179
  site=site,
167
180
  name=node_data.get("node_name"),
@@ -176,6 +189,7 @@ def get_nodes(
176
189
  storage_devices=node_data.get("storage_devices"),
177
190
  uid=node_data.get("uid"),
178
191
  version=node_data.get("version"),
192
+ reservable=blazar_host.get("reservable"),
179
193
  )
180
194
  if node.type not in node_types:
181
195
  node_types.append(node.type)
@@ -192,10 +206,11 @@ def get_nodes(
192
206
  or node.architecture.get("smt_size", 0) >= min_number_cpu
193
207
  )
194
208
 
209
+ free_and_reservable = node.uid not in reserved_now and node.reservable
195
210
  if (
196
211
  gpu_filter
197
212
  and cpu_filter
198
- and (not filter_reserved or node.uid not in reserved_now)
213
+ and (not filter_reserved or free_and_reservable)
199
214
  and (node_type is None or node.type == node_type)
200
215
  ):
201
216
  nodes.append(node)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: python-chi
3
- Version: 1.0.7
3
+ Version: 1.0.8
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": "857913c", "is_release": false}
@@ -5,5 +5,5 @@ from setuptools import setup
5
5
  setup(
6
6
  setup_requires=["pbr"],
7
7
  pbr=True,
8
- version='v1.0.7'
8
+ version='v1.0.8'
9
9
  )
@@ -1,7 +0,0 @@
1
- CHANGES
2
- =======
3
-
4
- v1.0.7
5
- ------
6
-
7
- * Fix typo in floating ip associate error handling
@@ -1 +0,0 @@
1
- {"git_version": "5731db4", "is_release": false}
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
File without changes
File without changes
File without changes