Skip to content

Commit 4f7cfcf

Browse files
committed
backwards compatibility
1 parent d324611 commit 4f7cfcf

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

sky/global_user_state.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,10 @@ def get_clusters(
17831783
'workspace': row.workspace,
17841784
'is_managed': bool(row.is_managed),
17851785
'config_hash': row.config_hash,
1786+
# TODO (syang) We still need to return this field for backwards
1787+
# compatibility.
1788+
# Remove this field at or after v0.10.7 or v0.11.0
1789+
'storage_mounts_metadata': None,
17861790
}
17871791
if not summary_response:
17881792
record['last_creation_yaml'] = row.last_creation_yaml

sky/schemas/api/responses.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@ class StatusResponse(ResponseBaseModel):
9898
# metadata is a JSON, so we use Any here.
9999
metadata: Optional[Dict[str, Any]] = None
100100
cluster_hash: str
101-
# pydantic cannot generate the pydantic-core schema for
102-
# storage_mounts_metadata, so we use Any here.
101+
# This field has been deprecated and always returns None.
102+
# Itwill be removed in the future.
103+
# Remove this field at or after v0.10.7 or v0.11.0
104+
# TODO (syang) We still need to return this field for backwards
105+
# compatibility so the encoder can still encode this field.
103106
storage_mounts_metadata: Optional[Dict[str, Any]] = None
104107
cluster_ever_up: bool
105108
status_updated_at: int

sky/server/requests/serializers/decoders.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,12 @@ def decode_status(
6060
if 'handle' in cluster and cluster['handle'] is not None:
6161
cluster['handle'] = decode_and_unpickle(cluster['handle'])
6262
cluster['status'] = status_lib.ClusterStatus(cluster['status'])
63-
# this field is to be deprecated in the future.
64-
# do not decode this field if it is not present.
65-
if ('storage_mounts_metadata' in cluster and
66-
cluster['storage_mounts_metadata'] is not None):
67-
cluster['storage_mounts_metadata'] = decode_and_unpickle(
68-
cluster['storage_mounts_metadata'])
6963
if 'is_managed' not in cluster:
7064
cluster['is_managed'] = False
65+
# TODO (syang) remove this code after the field is removed from
66+
# the response, at or after v0.10.7 or v0.11.0
67+
if 'storage_mounts_metadata' in cluster:
68+
del cluster['storage_mounts_metadata']
7169
response.append(responses.StatusResponse.model_validate(cluster))
7270
return response
7371

sky/server/requests/serializers/encoders.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ def encode_status(
6565
handle = serialize_utils.prepare_handle_for_backwards_compatibility(
6666
cluster['handle'])
6767
response_cluster['handle'] = pickle_and_encode(handle)
68+
# TODO (syang) We still need to return this field for backwards
69+
# compatibility.
70+
# Remove this field at or after v0.10.7 or v0.11.0
6871
response_cluster['storage_mounts_metadata'] = pickle_and_encode(
6972
response_cluster['storage_mounts_metadata'])
7073
response.append(response_cluster)

0 commit comments

Comments
 (0)