skypilot-nightly 1.0.0.dev20251001__py3-none-any.whl → 1.0.0.dev20251002__py3-none-any.whl

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.

Potentially problematic release.


This version of skypilot-nightly might be problematic. Click here for more details.

Files changed (35) hide show
  1. sky/__init__.py +2 -2
  2. sky/client/cli/command.py +2 -3
  3. sky/client/cli/table_utils.py +222 -1
  4. sky/dashboard/out/404.html +1 -1
  5. sky/dashboard/out/_next/static/chunks/{webpack-4f0c389a4ce5fd9c.js → webpack-7340bc0f0dd8ae74.js} +1 -1
  6. sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
  7. sky/dashboard/out/clusters/[cluster].html +1 -1
  8. sky/dashboard/out/clusters.html +1 -1
  9. sky/dashboard/out/config.html +1 -1
  10. sky/dashboard/out/index.html +1 -1
  11. sky/dashboard/out/infra/[context].html +1 -1
  12. sky/dashboard/out/infra.html +1 -1
  13. sky/dashboard/out/jobs/[job].html +1 -1
  14. sky/dashboard/out/jobs/pools/[pool].html +1 -1
  15. sky/dashboard/out/jobs.html +1 -1
  16. sky/dashboard/out/users.html +1 -1
  17. sky/dashboard/out/volumes.html +1 -1
  18. sky/dashboard/out/workspace/new.html +1 -1
  19. sky/dashboard/out/workspaces/[name].html +1 -1
  20. sky/dashboard/out/workspaces.html +1 -1
  21. sky/provision/kubernetes/utils.py +50 -28
  22. sky/schemas/api/responses.py +21 -0
  23. sky/server/requests/serializers/decoders.py +8 -0
  24. sky/server/requests/serializers/encoders.py +6 -0
  25. sky/volumes/client/sdk.py +3 -2
  26. sky/volumes/server/core.py +3 -2
  27. {skypilot_nightly-1.0.0.dev20251001.dist-info → skypilot_nightly-1.0.0.dev20251002.dist-info}/METADATA +36 -36
  28. {skypilot_nightly-1.0.0.dev20251001.dist-info → skypilot_nightly-1.0.0.dev20251002.dist-info}/RECORD +34 -35
  29. sky/volumes/utils.py +0 -224
  30. /sky/dashboard/out/_next/static/{m3YT2i5s6v4SsIdYc8WZa → 16g0-hgEgk6Db72hpE8MY}/_buildManifest.js +0 -0
  31. /sky/dashboard/out/_next/static/{m3YT2i5s6v4SsIdYc8WZa → 16g0-hgEgk6Db72hpE8MY}/_ssgManifest.js +0 -0
  32. {skypilot_nightly-1.0.0.dev20251001.dist-info → skypilot_nightly-1.0.0.dev20251002.dist-info}/WHEEL +0 -0
  33. {skypilot_nightly-1.0.0.dev20251001.dist-info → skypilot_nightly-1.0.0.dev20251002.dist-info}/entry_points.txt +0 -0
  34. {skypilot_nightly-1.0.0.dev20251001.dist-info → skypilot_nightly-1.0.0.dev20251002.dist-info}/licenses/LICENSE +0 -0
  35. {skypilot_nightly-1.0.0.dev20251001.dist-info → skypilot_nightly-1.0.0.dev20251002.dist-info}/top_level.txt +0 -0
sky/volumes/utils.py DELETED
@@ -1,224 +0,0 @@
1
- """Volume utils."""
2
- import abc
3
- from datetime import datetime
4
- from typing import Any, Dict, List, Optional
5
-
6
- import prettytable
7
-
8
- from sky import sky_logging
9
- from sky.skylet import constants
10
- from sky.utils import common_utils
11
- from sky.utils import log_utils
12
- from sky.utils import volume
13
-
14
- logger = sky_logging.init_logger(__name__)
15
-
16
- _BASIC_COLUMNS = [
17
- 'NAME',
18
- 'TYPE',
19
- 'INFRA',
20
- 'SIZE',
21
- 'USER',
22
- 'WORKSPACE',
23
- 'AGE',
24
- 'STATUS',
25
- 'LAST_USE',
26
- 'USED_BY',
27
- ]
28
-
29
-
30
- def _get_infra_str(cloud: Optional[str], region: Optional[str],
31
- zone: Optional[str]) -> str:
32
- """Get the infrastructure string for the volume."""
33
- infra = ''
34
- if cloud:
35
- infra += cloud
36
- if region:
37
- infra += f'/{region}'
38
- if zone:
39
- infra += f'/{zone}'
40
- return infra
41
-
42
-
43
- class VolumeTable(abc.ABC):
44
- """The volume table."""
45
-
46
- def __init__(self, volumes: List[Dict[str, Any]], show_all: bool = False):
47
- super().__init__()
48
- self.table = self._create_table(show_all)
49
- self._add_rows(volumes, show_all)
50
-
51
- def _get_row_base_columns(self,
52
- row: Dict[str, Any],
53
- show_all: bool = False) -> List[str]:
54
- """Get the base columns for a row."""
55
- # Convert last_attached_at timestamp to human readable string
56
- last_attached_at = row.get('last_attached_at')
57
- if last_attached_at is not None:
58
- last_attached_at_str = datetime.fromtimestamp(
59
- last_attached_at).strftime('%Y-%m-%d %H:%M:%S')
60
- else:
61
- last_attached_at_str = '-'
62
- size = row.get('size', '')
63
- if size:
64
- size = f'{size}Gi'
65
- usedby_str = '-'
66
- usedby_clusters = row.get('usedby_clusters')
67
- usedby_pods = row.get('usedby_pods')
68
- if usedby_clusters:
69
- usedby_str = f'{", ".join(usedby_clusters)}'
70
- elif usedby_pods:
71
- usedby_str = f'{", ".join(usedby_pods)}'
72
- if show_all:
73
- usedby = usedby_str
74
- else:
75
- usedby = common_utils.truncate_long_string(
76
- usedby_str, constants.USED_BY_TRUNC_LENGTH)
77
- infra = _get_infra_str(row.get('cloud'), row.get('region'),
78
- row.get('zone'))
79
- return [
80
- row.get('name', ''),
81
- row.get('type', ''),
82
- infra,
83
- size,
84
- row.get('user_name', '-'),
85
- row.get('workspace', '-'),
86
- log_utils.human_duration(row.get('launched_at', 0)),
87
- row.get('status', ''),
88
- last_attached_at_str,
89
- usedby,
90
- ]
91
-
92
- def _create_table(self, show_all: bool = False) -> prettytable.PrettyTable:
93
- """Create the volume table."""
94
- raise NotImplementedError
95
-
96
- def _add_rows(self,
97
- volumes: List[Dict[str, Any]],
98
- show_all: bool = False) -> None:
99
- """Add rows to the volume table."""
100
- raise NotImplementedError
101
-
102
- @abc.abstractmethod
103
- def format(self) -> str:
104
- """Format the volume table for display."""
105
- raise NotImplementedError
106
-
107
-
108
- class PVCVolumeTable(VolumeTable):
109
- """The PVC volume table."""
110
-
111
- def _create_table(self, show_all: bool = False) -> prettytable.PrettyTable:
112
- """Create the PVC volume table."""
113
- # If show_all is False, show the table with the columns:
114
- # NAME, TYPE, INFRA, SIZE, USER, WORKSPACE,
115
- # AGE, STATUS, LAST_USE, USED_BY
116
- # If show_all is True, show the table with the columns:
117
- # NAME, TYPE, INFRA, SIZE, USER, WORKSPACE,
118
- # AGE, STATUS, LAST_USE, USED_BY, NAME_ON_CLOUD
119
- # STORAGE_CLASS, ACCESS_MODE
120
-
121
- if show_all:
122
- columns = _BASIC_COLUMNS + [
123
- 'NAME_ON_CLOUD',
124
- 'STORAGE_CLASS',
125
- 'ACCESS_MODE',
126
- ]
127
- else:
128
- columns = _BASIC_COLUMNS
129
-
130
- table = log_utils.create_table(columns)
131
- return table
132
-
133
- def _add_rows(self,
134
- volumes: List[Dict[str, Any]],
135
- show_all: bool = False) -> None:
136
- """Add rows to the PVC volume table."""
137
- for row in volumes:
138
- table_row = self._get_row_base_columns(row, show_all)
139
- if show_all:
140
- table_row.append(row.get('name_on_cloud', ''))
141
- table_row.append(
142
- row.get('config', {}).get('storage_class_name', '-'))
143
- table_row.append(row.get('config', {}).get('access_mode', ''))
144
-
145
- self.table.add_row(table_row)
146
-
147
- def format(self) -> str:
148
- """Format the PVC volume table for display."""
149
- return 'Kubernetes PVCs:\n' + str(self.table)
150
-
151
-
152
- class RunPodVolumeTable(VolumeTable):
153
- """The RunPod volume table."""
154
-
155
- def _create_table(self, show_all: bool = False) -> prettytable.PrettyTable:
156
- """Create the RunPod volume table."""
157
- # If show_all is False, show the table with the columns:
158
- # NAME, TYPE, INFRA, SIZE, USER, WORKSPACE,
159
- # AGE, STATUS, LAST_USE, USED_BY
160
- # If show_all is True, show the table with the columns:
161
- # NAME, TYPE, INFRA, SIZE, USER, WORKSPACE,
162
- # AGE, STATUS, LAST_USE, USED_BY, NAME_ON_CLOUD
163
-
164
- if show_all:
165
- columns = _BASIC_COLUMNS + ['NAME_ON_CLOUD']
166
- else:
167
- columns = _BASIC_COLUMNS
168
-
169
- table = log_utils.create_table(columns)
170
- return table
171
-
172
- def _add_rows(self,
173
- volumes: List[Dict[str, Any]],
174
- show_all: bool = False) -> None:
175
- """Add rows to the RunPod volume table."""
176
- for row in volumes:
177
- table_row = self._get_row_base_columns(row, show_all)
178
- if show_all:
179
- table_row.append(row.get('name_on_cloud', ''))
180
-
181
- self.table.add_row(table_row)
182
-
183
- def format(self) -> str:
184
- """Format the RunPod volume table for display."""
185
- return 'RunPod Network Volumes:\n' + str(self.table)
186
-
187
-
188
- def format_volume_table(volumes: List[Dict[str, Any]],
189
- show_all: bool = False) -> str:
190
- """Format the volume table for display.
191
-
192
- Args:
193
- volume_table (dict): The volume table.
194
-
195
- Returns:
196
- str: The formatted volume table.
197
- """
198
- volumes_per_type: Dict[str, List[Dict[str, Any]]] = {}
199
- supported_volume_types = [
200
- volume_type.value for volume_type in volume.VolumeType
201
- ]
202
- for row in volumes:
203
- volume_type = row.get('type', '')
204
- if volume_type in supported_volume_types:
205
- if volume_type not in volumes_per_type:
206
- volumes_per_type[volume_type] = []
207
- volumes_per_type[volume_type].append(row)
208
- else:
209
- logger.warning(f'Unknown volume type: {volume_type}')
210
- continue
211
- table_str = ''
212
- for volume_type, volume_list in volumes_per_type.items():
213
- if table_str:
214
- table_str += '\n\n'
215
- if volume_type == volume.VolumeType.PVC.value:
216
- pvc_table = PVCVolumeTable(volume_list, show_all)
217
- table_str += pvc_table.format()
218
- elif volume_type == volume.VolumeType.RUNPOD_NETWORK_VOLUME.value:
219
- runpod_table = RunPodVolumeTable(volume_list, show_all)
220
- table_str += runpod_table.format()
221
- if table_str:
222
- return table_str
223
- else:
224
- return 'No existing volumes.'