Skip to content

Commit ffc8618

Browse files
authored
[Lambda] Fix termination for lambda (#3410)
* Fix termination for lambda * format
1 parent 76e1e4c commit ffc8618

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

sky/clouds/lambda_cloud.py

+1
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ def query_status(cls, name: str, tag_filters: Dict[str, str],
280280
'booting': status_lib.ClusterStatus.INIT,
281281
'active': status_lib.ClusterStatus.UP,
282282
'unhealthy': status_lib.ClusterStatus.INIT,
283+
'terminating': None,
283284
'terminated': None,
284285
}
285286
# TODO(ewzeng): filter by hash_filter_string to be safe

sky/skylet/providers/lambda_cloud/node_provider.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _match_tags(vm: Dict[str, Any]):
152152
def _get_internal_ip(node: Dict[str, Any]):
153153
# TODO(ewzeng): cache internal ips in metadata file to reduce
154154
# ssh overhead.
155-
if node['external_ip'] is None:
155+
if node['external_ip'] is None or node['status'] != 'active':
156156
node['internal_ip'] = None
157157
return
158158
runner = command_runner.SSHCommandRunner(node['external_ip'],
@@ -172,6 +172,10 @@ def _get_internal_ip(node: Dict[str, Any]):
172172
self.metadata.refresh([node['id'] for node in vms])
173173
self._guess_and_add_missing_tags(vms)
174174
nodes = [_extract_metadata(vm) for vm in filter(_match_tags, vms)]
175+
nodes = [
176+
node for node in nodes
177+
if node['status'] not in ['terminating', 'terminated']
178+
]
175179
subprocess_utils.run_in_parallel(_get_internal_ip, nodes)
176180
self.cached_nodes = {node['id']: node for node in nodes}
177181
return self.cached_nodes

0 commit comments

Comments
 (0)