Skip to content

Commit

Permalink
wait for instance starting
Browse files Browse the repository at this point in the history
  • Loading branch information
suquark committed Oct 28, 2023
1 parent 71ce79c commit 8a20be3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 11 additions & 0 deletions sky/provision/gcp/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,17 @@ def get_order_key(node):
# are started correctly.
created_instance_ids = [instance_id for success, instance_id in results]

while True:
# wait until all instances are running
instances = resource.filter(
project_id=project_id,
zone=availability_zone,
label_filters=filter_labels,
status_filters=PENDING_STATUS,
)
if not instances:
break

return common.ProvisionRecord(provider_name='gcp',
region=region,
zone=availability_zone,
Expand Down
3 changes: 1 addition & 2 deletions sky/provision/gcp/instance_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,8 +969,7 @@ def set_labels(cls,
labels: dict,
wait_for_operation: bool = True) -> dict:
node = cls.load_resource().projects().locations().nodes().get(
name=node_id,
)
name=node_id)
body = {
"labels": dict(node["labels"], **labels),
}
Expand Down

0 comments on commit 8a20be3

Please sign in to comment.