Skip to content

Commit 3455675

Browse files
committed
fixed edge case: boot volume name length
1 parent 35e23f6 commit 3455675

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = ibm-vpc-ray-connector
3-
version = 1.0.0b73
3+
version = 1.0.0b75
44
author = kpavel, cohen-j-omer
55
author_email = [email protected]
66
description = IBM VPC connector for Ray

src/vpc/node_provider.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,14 @@ def _load_tags(self):
122122
# filters instances that were deleted since the last time the head node was up
123123
for instance_id, instance_tags in tags.items():
124124
try:
125-
self.ibm_vpc_client.get_instance(instance_id)
126-
self.nodes_tags[instance_id] = instance_tags
125+
instance = self.ibm_vpc_client.get_instance(instance_id).get_result()
126+
if instance and instance["status"] not in ["deleting","failed"]:
127+
self.nodes_tags[instance_id] = instance_tags
128+
else:
129+
logger.warning(
130+
f"cached instance {instance_id} is not in a valid state, \
131+
and will be removed from cache"
132+
)
127133
except Exception as e:
128134
cli_logger.warning(instance_id)
129135
if e.message == "Instance not found":
@@ -343,7 +349,6 @@ def is_terminated(self, node_id)-> bool:
343349
logger.debug(f"""node: {node_id} is_terminated? {node["status"] not in ["running", "starting", "pending"]}""")
344350
return node["status"] not in ["running", "starting", "pending"]
345351
except Exception:
346-
logger.debug(f"""node: {node_id} is_terminated? TRUE""")
347352
return True
348353

349354

@@ -446,7 +451,7 @@ def _create_instance(self, name, base_config):
446451

447452
boot_volume_profile = {
448453
"capacity": base_config.get("boot_volume_capacity", 100),
449-
"name": "{}-boot".format(name),
454+
"name": f"boot-volume-{uuid4().hex[:4]}",
450455
"profile": {
451456
"name": base_config.get("volume_tier_name", VOLUME_TIER_NAME_DEFAULT)
452457
},
@@ -631,7 +636,7 @@ def create_node(self, base_config, tags, count) -> None:
631636
count(int): number of nodes to create.
632637
633638
"""
634-
logger.debug(f"""create_node: count: {count}\ntags: {pprint(tags)}\nbase_config:{pprint(base_config)}\n """)
639+
logger.debug(f"""create_node:\ncount:{count}\ntags:{pprint(tags)}\nbase_config:{pprint(base_config)}\n """)
635640
stopped_nodes_dict = {}
636641
futures = []
637642

0 commit comments

Comments
 (0)