skypilot-nightly 1.0.0.dev20250612__py3-none-any.whl → 1.0.0.dev20250614__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.
- sky/__init__.py +4 -2
- sky/adaptors/hyperbolic.py +8 -0
- sky/adaptors/kubernetes.py +3 -2
- sky/authentication.py +20 -2
- sky/backends/backend_utils.py +11 -3
- sky/backends/cloud_vm_ray_backend.py +2 -1
- sky/benchmark/benchmark_state.py +2 -1
- sky/catalog/data_fetchers/fetch_aws.py +1 -1
- sky/catalog/data_fetchers/fetch_hyperbolic.py +136 -0
- sky/catalog/data_fetchers/fetch_vast.py +1 -1
- sky/catalog/hyperbolic_catalog.py +133 -0
- sky/check.py +2 -1
- sky/cli.py +1 -1
- sky/client/cli.py +1 -1
- sky/clouds/__init__.py +2 -0
- sky/clouds/cloud.py +1 -1
- sky/clouds/gcp.py +1 -1
- sky/clouds/hyperbolic.py +276 -0
- sky/clouds/kubernetes.py +8 -2
- sky/clouds/ssh.py +7 -3
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/chunks/37-7754056a4b503e1d.js +6 -0
- sky/dashboard/out/_next/static/chunks/600.bd2ed8c076b720ec.js +16 -0
- sky/dashboard/out/_next/static/chunks/{856-0776dc6ed6000c39.js → 856-c2c39c0912285e54.js} +1 -1
- sky/dashboard/out/_next/static/chunks/938-245c9ac4c9e8bf15.js +1 -0
- sky/dashboard/out/_next/static/chunks/{webpack-208a9812ab4f61c9.js → webpack-27de3d9d450d81c6.js} +1 -1
- sky/dashboard/out/_next/static/css/{5d71bfc09f184bab.css → 6f84444b8f3c656c.css} +1 -1
- sky/dashboard/out/_next/static/{G3DXdMFu2Jzd-Dody9iq1 → nm5jrKpUZh2W0SxzyDKhz}/_buildManifest.js +1 -1
- sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
- sky/dashboard/out/clusters/[cluster].html +1 -1
- sky/dashboard/out/clusters.html +1 -1
- sky/dashboard/out/config.html +1 -1
- sky/dashboard/out/index.html +1 -1
- sky/dashboard/out/infra/[context].html +1 -1
- sky/dashboard/out/infra.html +1 -1
- sky/dashboard/out/jobs/[job].html +1 -1
- sky/dashboard/out/jobs.html +1 -1
- sky/dashboard/out/users.html +1 -1
- sky/dashboard/out/workspace/new.html +1 -1
- sky/dashboard/out/workspaces/[name].html +1 -1
- sky/dashboard/out/workspaces.html +1 -1
- sky/data/storage.py +2 -2
- sky/jobs/state.py +43 -44
- sky/provision/__init__.py +1 -0
- sky/provision/common.py +1 -1
- sky/provision/gcp/config.py +1 -1
- sky/provision/hyperbolic/__init__.py +11 -0
- sky/provision/hyperbolic/config.py +10 -0
- sky/provision/hyperbolic/instance.py +423 -0
- sky/provision/hyperbolic/utils.py +373 -0
- sky/provision/kubernetes/instance.py +2 -1
- sky/provision/kubernetes/utils.py +60 -13
- sky/resources.py +2 -2
- sky/serve/serve_state.py +81 -15
- sky/server/requests/preconditions.py +1 -1
- sky/server/requests/requests.py +11 -6
- sky/setup_files/dependencies.py +2 -1
- sky/skylet/configs.py +26 -19
- sky/skylet/constants.py +1 -1
- sky/skylet/job_lib.py +3 -5
- sky/task.py +1 -1
- sky/templates/hyperbolic-ray.yml.j2 +67 -0
- sky/templates/kubernetes-ray.yml.j2 +1 -1
- sky/users/permission.py +2 -0
- sky/utils/common_utils.py +6 -0
- sky/utils/context.py +1 -1
- sky/utils/infra_utils.py +1 -1
- sky/utils/kubernetes/generate_kubeconfig.sh +1 -1
- {skypilot_nightly-1.0.0.dev20250612.dist-info → skypilot_nightly-1.0.0.dev20250614.dist-info}/METADATA +2 -1
- {skypilot_nightly-1.0.0.dev20250612.dist-info → skypilot_nightly-1.0.0.dev20250614.dist-info}/RECORD +79 -70
- sky/dashboard/out/_next/static/chunks/37-d8aebf1683522a0b.js +0 -6
- sky/dashboard/out/_next/static/chunks/600.15a0009177e86b86.js +0 -16
- sky/dashboard/out/_next/static/chunks/938-ab185187a63f9cdb.js +0 -1
- /sky/dashboard/out/_next/static/chunks/{843-6fcc4bf91ac45b39.js → 843-5011affc9540757f.js} +0 -0
- /sky/dashboard/out/_next/static/chunks/pages/{_app-7bbd9d39d6f9a98a.js → _app-664031f6ae737f80.js} +0 -0
- /sky/dashboard/out/_next/static/chunks/pages/clusters/{[cluster]-451a14e7e755ebbc.js → [cluster]-20210f8cd809063d.js} +0 -0
- /sky/dashboard/out/_next/static/chunks/pages/{jobs-fe233baf3d073491.js → jobs-ae7a5e9fa5a5b5f0.js} +0 -0
- /sky/dashboard/out/_next/static/{G3DXdMFu2Jzd-Dody9iq1 → nm5jrKpUZh2W0SxzyDKhz}/_ssgManifest.js +0 -0
- {skypilot_nightly-1.0.0.dev20250612.dist-info → skypilot_nightly-1.0.0.dev20250614.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250612.dist-info → skypilot_nightly-1.0.0.dev20250614.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250612.dist-info → skypilot_nightly-1.0.0.dev20250614.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250612.dist-info → skypilot_nightly-1.0.0.dev20250614.dist-info}/top_level.txt +0 -0
sky/clouds/hyperbolic.py
ADDED
@@ -0,0 +1,276 @@
|
|
1
|
+
"""Hyperbolic Cloud provider implementation
|
2
|
+
for SkyPilot.
|
3
|
+
"""
|
4
|
+
import os
|
5
|
+
import typing
|
6
|
+
from typing import Any, Dict, List, Optional, Tuple, Union
|
7
|
+
|
8
|
+
from sky import catalog
|
9
|
+
from sky import clouds
|
10
|
+
from sky.utils import registry
|
11
|
+
from sky.utils import resources_utils
|
12
|
+
from sky.utils.resources_utils import DiskTier
|
13
|
+
|
14
|
+
if typing.TYPE_CHECKING:
|
15
|
+
from sky import resources as resources_lib
|
16
|
+
|
17
|
+
|
18
|
+
@registry.CLOUD_REGISTRY.register
|
19
|
+
class Hyperbolic(clouds.Cloud):
|
20
|
+
"""Hyperbolic Cloud Provider."""
|
21
|
+
|
22
|
+
_REPR = 'Hyperbolic'
|
23
|
+
name = 'hyperbolic'
|
24
|
+
_MAX_CLUSTER_NAME_LEN_LIMIT = 120
|
25
|
+
API_KEY_PATH = os.path.expanduser('~/.hyperbolic/api_key')
|
26
|
+
|
27
|
+
_CLOUD_UNSUPPORTED_FEATURES = {
|
28
|
+
clouds.CloudImplementationFeatures.STOP: ('Stopping not supported.'),
|
29
|
+
clouds.CloudImplementationFeatures.MULTI_NODE:
|
30
|
+
('Multi-node not supported.'),
|
31
|
+
clouds.CloudImplementationFeatures.CUSTOM_DISK_TIER:
|
32
|
+
('Custom disk tiers not supported.'),
|
33
|
+
clouds.CloudImplementationFeatures.STORAGE_MOUNTING:
|
34
|
+
('Storage mounting not supported.'),
|
35
|
+
clouds.CloudImplementationFeatures.HIGH_AVAILABILITY_CONTROLLERS:
|
36
|
+
('High availability controllers not supported.'),
|
37
|
+
clouds.CloudImplementationFeatures.SPOT_INSTANCE:
|
38
|
+
('Spot instances not supported.'),
|
39
|
+
clouds.CloudImplementationFeatures.CLONE_DISK_FROM_CLUSTER:
|
40
|
+
('Disk cloning not supported.'),
|
41
|
+
clouds.CloudImplementationFeatures.DOCKER_IMAGE:
|
42
|
+
('Docker images not supported.'),
|
43
|
+
clouds.CloudImplementationFeatures.OPEN_PORTS:
|
44
|
+
('Opening ports not supported.'),
|
45
|
+
clouds.CloudImplementationFeatures.IMAGE_ID:
|
46
|
+
('Custom image IDs not supported.'),
|
47
|
+
clouds.CloudImplementationFeatures.CUSTOM_NETWORK_TIER:
|
48
|
+
('Custom network tiers not supported.'),
|
49
|
+
clouds.CloudImplementationFeatures.HOST_CONTROLLERS:
|
50
|
+
('Host controllers not supported.'),
|
51
|
+
clouds.CloudImplementationFeatures.AUTO_TERMINATE:
|
52
|
+
('Auto-termination not supported.'),
|
53
|
+
clouds.CloudImplementationFeatures.AUTOSTOP:
|
54
|
+
('Auto-stop not supported.'),
|
55
|
+
clouds.CloudImplementationFeatures.AUTODOWN:
|
56
|
+
('Auto-down not supported.'),
|
57
|
+
}
|
58
|
+
|
59
|
+
PROVISIONER_VERSION = clouds.ProvisionerVersion.SKYPILOT
|
60
|
+
STATUS_VERSION = clouds.StatusVersion.SKYPILOT
|
61
|
+
OPEN_PORTS_VERSION = clouds.OpenPortsVersion.LAUNCH_ONLY
|
62
|
+
|
63
|
+
@classmethod
|
64
|
+
def _unsupported_features_for_resources(
|
65
|
+
cls, resources: 'resources_lib.Resources'
|
66
|
+
) -> Dict[clouds.CloudImplementationFeatures, str]:
|
67
|
+
del resources
|
68
|
+
return cls._CLOUD_UNSUPPORTED_FEATURES
|
69
|
+
|
70
|
+
@classmethod
|
71
|
+
def _max_cluster_name_length(cls) -> Optional[int]:
|
72
|
+
return cls._MAX_CLUSTER_NAME_LEN_LIMIT
|
73
|
+
|
74
|
+
def instance_type_exists(self, instance_type: str) -> bool:
|
75
|
+
return catalog.instance_type_exists(instance_type, 'hyperbolic')
|
76
|
+
|
77
|
+
@classmethod
|
78
|
+
def regions_with_offering(cls, instance_type: str,
|
79
|
+
accelerators: Optional[Dict[str, int]],
|
80
|
+
use_spot: bool, region: Optional[str],
|
81
|
+
zone: Optional[str]) -> List[clouds.Region]:
|
82
|
+
assert zone is None, 'Hyperbolic does not support zones.'
|
83
|
+
del accelerators, zone # unused
|
84
|
+
|
85
|
+
regions = catalog.get_region_zones_for_instance_type(
|
86
|
+
instance_type, use_spot, 'hyperbolic')
|
87
|
+
if region is not None:
|
88
|
+
regions = [r for r in regions if r.name == region]
|
89
|
+
return regions
|
90
|
+
|
91
|
+
@classmethod
|
92
|
+
def get_vcpus_mem_from_instance_type(
|
93
|
+
cls, instance_type: str) -> Tuple[Optional[float], Optional[float]]:
|
94
|
+
return catalog.get_vcpus_mem_from_instance_type(instance_type,
|
95
|
+
clouds='hyperbolic')
|
96
|
+
|
97
|
+
def instance_type_to_hourly_cost(self,
|
98
|
+
instance_type: str,
|
99
|
+
use_spot: bool,
|
100
|
+
region: Optional[str] = None,
|
101
|
+
zone: Optional[str] = None) -> float:
|
102
|
+
return catalog.get_hourly_cost(instance_type,
|
103
|
+
use_spot=use_spot,
|
104
|
+
region=region,
|
105
|
+
zone=zone,
|
106
|
+
clouds='hyperbolic')
|
107
|
+
|
108
|
+
@classmethod
|
109
|
+
def get_default_instance_type(
|
110
|
+
cls,
|
111
|
+
cpus: Optional[str] = None,
|
112
|
+
memory: Optional[str] = None,
|
113
|
+
disk_tier: Optional[DiskTier] = None) -> Optional[str]:
|
114
|
+
return catalog.get_default_instance_type(cpus=cpus,
|
115
|
+
memory=memory,
|
116
|
+
disk_tier=disk_tier,
|
117
|
+
clouds='hyperbolic')
|
118
|
+
|
119
|
+
@classmethod
|
120
|
+
def get_accelerators_from_instance_type(
|
121
|
+
cls, instance_type: str) -> Optional[Dict[str, Union[int, float]]]:
|
122
|
+
return catalog.get_accelerators_from_instance_type(instance_type,
|
123
|
+
clouds='hyperbolic')
|
124
|
+
|
125
|
+
@classmethod
|
126
|
+
def _check_credentials(cls) -> Tuple[bool, Optional[str]]:
|
127
|
+
if os.path.exists(cls.API_KEY_PATH):
|
128
|
+
return True, None
|
129
|
+
return False, f'API key not found at {cls.API_KEY_PATH}'
|
130
|
+
|
131
|
+
@classmethod
|
132
|
+
def _check_compute_credentials(cls) -> Tuple[bool, Optional[str]]:
|
133
|
+
return cls._check_credentials()
|
134
|
+
|
135
|
+
@classmethod
|
136
|
+
def get_credential_file_mounts(cls) -> Dict[str, str]:
|
137
|
+
if os.path.exists(cls.API_KEY_PATH):
|
138
|
+
return {cls.API_KEY_PATH: '~/.hyperbolic/api_key'}
|
139
|
+
return {}
|
140
|
+
|
141
|
+
def __repr__(self):
|
142
|
+
return self._REPR
|
143
|
+
|
144
|
+
def _get_feasible_launchable_resources(
|
145
|
+
self, resources: 'resources_lib.Resources'
|
146
|
+
) -> 'resources_utils.FeasibleResources':
|
147
|
+
# Check if the instance type exists in the catalog
|
148
|
+
if resources.instance_type is not None:
|
149
|
+
if catalog.instance_type_exists(resources.instance_type,
|
150
|
+
'hyperbolic'):
|
151
|
+
# Remove accelerators for launchable resources
|
152
|
+
resources_launch = resources.copy(accelerators=None)
|
153
|
+
return resources_utils.FeasibleResources([resources_launch], [],
|
154
|
+
None)
|
155
|
+
else:
|
156
|
+
raise ValueError(
|
157
|
+
f'Invalid instance type: {resources.instance_type}')
|
158
|
+
|
159
|
+
# If accelerators are specified
|
160
|
+
accelerators = resources.accelerators
|
161
|
+
if accelerators is not None:
|
162
|
+
assert len(accelerators) == 1, resources
|
163
|
+
acc, acc_count = list(accelerators.items())[0]
|
164
|
+
(instance_list,
|
165
|
+
fuzzy_candidate_list) = catalog.get_instance_type_for_accelerator(
|
166
|
+
acc,
|
167
|
+
acc_count,
|
168
|
+
use_spot=resources.use_spot,
|
169
|
+
cpus=resources.cpus,
|
170
|
+
memory=resources.memory,
|
171
|
+
region=resources.region,
|
172
|
+
zone=resources.zone,
|
173
|
+
clouds='hyperbolic')
|
174
|
+
if instance_list is None:
|
175
|
+
return resources_utils.FeasibleResources([],
|
176
|
+
fuzzy_candidate_list,
|
177
|
+
None)
|
178
|
+
|
179
|
+
def _make(instance_list):
|
180
|
+
resource_list = []
|
181
|
+
for instance_type in instance_list:
|
182
|
+
r = resources.copy(
|
183
|
+
cloud=self,
|
184
|
+
instance_type=instance_type,
|
185
|
+
accelerators=None,
|
186
|
+
cpus=None,
|
187
|
+
memory=None,
|
188
|
+
)
|
189
|
+
resource_list.append(r)
|
190
|
+
return resource_list
|
191
|
+
|
192
|
+
return resources_utils.FeasibleResources(_make(instance_list),
|
193
|
+
fuzzy_candidate_list, None)
|
194
|
+
|
195
|
+
# If nothing is specified, return a default instance type
|
196
|
+
default_instance_type = self.get_default_instance_type(
|
197
|
+
cpus=resources.cpus,
|
198
|
+
memory=resources.memory,
|
199
|
+
disk_tier=resources.disk_tier)
|
200
|
+
if default_instance_type is None:
|
201
|
+
return resources_utils.FeasibleResources([], [], None)
|
202
|
+
else:
|
203
|
+
r = resources.copy(
|
204
|
+
cloud=self,
|
205
|
+
instance_type=default_instance_type,
|
206
|
+
accelerators=None,
|
207
|
+
cpus=None,
|
208
|
+
memory=None,
|
209
|
+
)
|
210
|
+
return resources_utils.FeasibleResources([r], [], None)
|
211
|
+
|
212
|
+
def validate_region_zone(
|
213
|
+
self, region: Optional[str],
|
214
|
+
zone: Optional[str]) -> Tuple[Optional[str], Optional[str]]:
|
215
|
+
if zone is not None:
|
216
|
+
raise ValueError('Hyperbolic does not support zones.')
|
217
|
+
return catalog.validate_region_zone(region, zone, 'hyperbolic')
|
218
|
+
|
219
|
+
@classmethod
|
220
|
+
def regions(cls) -> List[clouds.Region]:
|
221
|
+
"""Returns the list of regions in Hyperbolic's catalog."""
|
222
|
+
return catalog.regions('hyperbolic')
|
223
|
+
|
224
|
+
@classmethod
|
225
|
+
def zones_provision_loop(cls,
|
226
|
+
*,
|
227
|
+
region: str,
|
228
|
+
num_nodes: int,
|
229
|
+
instance_type: str,
|
230
|
+
accelerators: Optional[Dict[str, int]] = None,
|
231
|
+
use_spot: bool = False):
|
232
|
+
yield None
|
233
|
+
|
234
|
+
@classmethod
|
235
|
+
def get_zone_shell_cmd(cls) -> Optional[str]:
|
236
|
+
return None
|
237
|
+
|
238
|
+
def get_egress_cost(self, num_gigabytes: float):
|
239
|
+
return 0.0
|
240
|
+
|
241
|
+
def accelerators_to_hourly_cost(self, accelerators: Dict[str, int],
|
242
|
+
use_spot: bool, region: Optional[str],
|
243
|
+
zone: Optional[str]) -> float:
|
244
|
+
return 0.0
|
245
|
+
|
246
|
+
def make_deploy_resources_variables(
|
247
|
+
self,
|
248
|
+
resources: 'resources_lib.Resources',
|
249
|
+
cluster_name: resources_utils.ClusterName,
|
250
|
+
region: 'clouds.Region',
|
251
|
+
zones: Optional[List['clouds.Zone']],
|
252
|
+
num_nodes: int,
|
253
|
+
dryrun: bool = False) -> Dict[str, Any]:
|
254
|
+
"""Returns a dict of variables for the deployment template."""
|
255
|
+
del dryrun, region, cluster_name # unused
|
256
|
+
assert zones is None, ('Hyperbolic does not support zones', zones)
|
257
|
+
|
258
|
+
resources = resources.assert_launchable()
|
259
|
+
# resources.accelerators is cleared but .instance_type encodes the info.
|
260
|
+
acc_dict = self.get_accelerators_from_instance_type(
|
261
|
+
resources.instance_type)
|
262
|
+
custom_resources = resources_utils.make_ray_custom_resources_str(
|
263
|
+
acc_dict)
|
264
|
+
|
265
|
+
return {
|
266
|
+
'instance_type': resources.instance_type,
|
267
|
+
'custom_resources': custom_resources,
|
268
|
+
'num_nodes': 1, # Hyperbolic only supports single-node clusters
|
269
|
+
}
|
270
|
+
|
271
|
+
def cluster_name_in_hint(self, cluster_name_on_cloud: Optional[str],
|
272
|
+
cluster_name: str) -> bool:
|
273
|
+
"""Check if a node's name matches the cluster name pattern."""
|
274
|
+
if cluster_name_on_cloud is None:
|
275
|
+
return False
|
276
|
+
return cluster_name_on_cloud.startswith(cluster_name)
|
sky/clouds/kubernetes.py
CHANGED
@@ -17,6 +17,8 @@ from sky.adaptors import kubernetes
|
|
17
17
|
from sky.provision import instance_setup
|
18
18
|
from sky.provision.kubernetes import network_utils
|
19
19
|
from sky.provision.kubernetes import utils as kubernetes_utils
|
20
|
+
from sky.provision.kubernetes.utils import is_tpu_on_gke
|
21
|
+
from sky.provision.kubernetes.utils import normalize_tpu_accelerator_name
|
20
22
|
from sky.skylet import constants
|
21
23
|
from sky.utils import annotations
|
22
24
|
from sky.utils import common_utils
|
@@ -440,8 +442,12 @@ class Kubernetes(clouds.Cloud):
|
|
440
442
|
cpus = k.cpus
|
441
443
|
mem = k.memory
|
442
444
|
# Optionally populate accelerator information.
|
443
|
-
|
444
|
-
|
445
|
+
acc_type = k.accelerator_type
|
446
|
+
acc_count = k.accelerator_count
|
447
|
+
if acc_type is not None and is_tpu_on_gke(acc_type):
|
448
|
+
acc_type, acc_count = normalize_tpu_accelerator_name(acc_type)
|
449
|
+
else:
|
450
|
+
acc_count = acc_count or 0
|
445
451
|
|
446
452
|
def _get_image_id(resources: 'resources_lib.Resources') -> str:
|
447
453
|
image_id_dict = resources.image_id
|
sky/clouds/ssh.py
CHANGED
@@ -12,6 +12,7 @@ from sky.adaptors import kubernetes as kubernetes_adaptor
|
|
12
12
|
from sky.clouds import kubernetes
|
13
13
|
from sky.provision.kubernetes import utils as kubernetes_utils
|
14
14
|
from sky.utils import annotations
|
15
|
+
from sky.utils import common_utils
|
15
16
|
from sky.utils import registry
|
16
17
|
|
17
18
|
if typing.TYPE_CHECKING:
|
@@ -88,8 +89,10 @@ class SSH(kubernetes.Kubernetes):
|
|
88
89
|
all_contexts = self.existing_allowed_contexts()
|
89
90
|
|
90
91
|
if region is not None and region not in all_contexts:
|
91
|
-
region_name =
|
92
|
-
available_contexts = [
|
92
|
+
region_name = common_utils.removeprefix(region, 'ssh-')
|
93
|
+
available_contexts = [
|
94
|
+
common_utils.removeprefix(c, 'ssh-') for c in all_contexts
|
95
|
+
]
|
93
96
|
err_str = (f'SSH Node Pool {region_name!r} is not set up. '
|
94
97
|
'Run `sky check` for more details. ')
|
95
98
|
if available_contexts:
|
@@ -155,7 +158,8 @@ class SSH(kubernetes.Kubernetes):
|
|
155
158
|
if allowed_node_pools is None:
|
156
159
|
return ctxs
|
157
160
|
return [
|
158
|
-
ctx for ctx in ctxs
|
161
|
+
ctx for ctx in ctxs
|
162
|
+
if common_utils.removeprefix(ctx, 'ssh-') in allowed_node_pools
|
159
163
|
]
|
160
164
|
|
161
165
|
if all_node_pool_contexts:
|
sky/dashboard/out/404.html
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/dashboard/_next/static/css/
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/dashboard/_next/static/css/6f84444b8f3c656c.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/6f84444b8f3c656c.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/dashboard/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/dashboard/_next/static/chunks/webpack-27de3d9d450d81c6.js" defer=""></script><script src="/dashboard/_next/static/chunks/framework-87d061ee6ed71b28.js" defer=""></script><script src="/dashboard/_next/static/chunks/main-e0e2335212e72357.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_app-664031f6ae737f80.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-1be831200e60c5c0.js" defer=""></script><script src="/dashboard/_next/static/nm5jrKpUZh2W0SxzyDKhz/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/nm5jrKpUZh2W0SxzyDKhz/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"nm5jrKpUZh2W0SxzyDKhz","assetPrefix":"/dashboard","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[37,211],{9037:function(e,s,r){r.r(s),r.d(s,{ClusterTable:function(){return O},Clusters:function(){return M},Status2Actions:function(){return W},enabledActions:function(){return E},handleVSCodeConnection:function(){return q}});var t=r(5893),n=r(7294),a=r(1163),l=r(8799),i=r(6989),c=r(1664),o=r.n(c),d=r(803),u=r(7673),h=r(8764),x=r(3266),p=r(7324),f=r(3081),m=r(4545),j=r(3626),g=r(998);/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let v=(0,g.Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),y=(0,g.Z)("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);r(9470);var w=r(9284),N=r(9307),b=r(3001),k=r(8950),C=r(6378),S=r(6856);r(1272);let _="__ALL_WORKSPACES__",R="__ALL_USERS__",A=(e,s)=>{let r="",t="";return e>=0&&(r=e+"m",t=" "),s&&(r+="".concat(t,"(down)")),""===r&&(r="-"),r},I=(e,s)=>{if(e&&e.includes("@")){let r=e.split("@")[0];return s&&s!==r?"".concat(r," (").concat(s,")"):r}let r=e||s||"N/A";return s&&s!==r?"".concat(r," (").concat(s,")"):r};function M(){var e;let s=(0,a.useRouter)(),[r,c]=(0,n.useState)(!1),d=n.useRef(null),[u,h]=(0,n.useState)(!1),[m,g]=(0,n.useState)(!1),[v,y]=(0,n.useState)(null),[N,A]=(0,n.useState)(_),[M,q]=(0,n.useState)(R),[L,E]=(0,n.useState)([]),[V,W]=(0,n.useState)([]),z=(0,b.X)();(0,n.useEffect)(()=>{s.isReady&&(s.query.workspace&&A(Array.isArray(s.query.workspace)?s.query.workspace[0]:s.query.workspace),s.query.user&&q(Array.isArray(s.query.user)?s.query.user[0]:s.query.user))},[s.isReady,s.query.workspace,s.query.user]);let T=(e,r)=>{let t={...s.query};e&&e!==_?t.workspace=e:delete t.workspace,r&&r!==R?t.user=r:delete t.user,s.replace({pathname:s.pathname,query:t},void 0,{shallow:!0})};return(0,n.useEffect)(()=>{(async()=>{try{await S.ZP.preloadForPage("clusters");let e=await C.default.get(p.fX),s=Object.keys(e),r=await C.default.get(x.getClusters),t=[...new Set(r.map(e=>e.workspace||"default").filter(e=>e))],n=new Set(s);t.includes("default")&&n.has("default"),t.forEach(e=>n.add(e)),E(Array.from(n).sort());let a=await C.default.get(f.R),l=[...new Set(r.map(e=>({userId:e.user_hash||e.user,username:e.user})).filter(e=>e.userId)).values()],i=new Map;a.forEach(e=>{i.set(e.userId,{userId:e.userId,username:e.username,display:I(e.username,e.userId)})}),l.forEach(e=>{i.has(e.userId)||i.set(e.userId,{userId:e.userId,username:e.username,display:I(e.username,e.userId)})}),W(Array.from(i.values()).sort((e,s)=>e.display.localeCompare(s.display)))}catch(e){console.error("Error fetching data for filters:",e),E(["default"]),W([])}})()},[]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,t.jsxs)("div",{className:"text-base flex items-center",children:[(0,t.jsx)(o(),{href:"/clusters",className:"text-sky-blue hover:underline leading-none",children:"Sky Clusters"}),(0,t.jsxs)(k.Ph,{value:N,onValueChange:e=>{A(e),T(e,M)},children:[(0,t.jsx)(k.i4,{className:"h-8 w-48 ml-4 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,t.jsx)(k.ki,{placeholder:"Filter by workspace...",children:N===_?"All Workspaces":N})}),(0,t.jsxs)(k.Bw,{children:[(0,t.jsx)(k.Ql,{value:_,children:"All Workspaces"}),L.map(e=>(0,t.jsx)(k.Ql,{value:e,children:e},e))]})]}),(0,t.jsxs)(k.Ph,{value:M,onValueChange:e=>{q(e),T(N,e)},children:[(0,t.jsx)(k.i4,{className:"h-8 w-48 ml-2 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,t.jsx)(k.ki,{placeholder:"Filter by user...",children:M===R?"All Users":(null===(e=V.find(e=>e.userId===M))||void 0===e?void 0:e.display)||M})}),(0,t.jsxs)(k.Bw,{children:[(0,t.jsx)(k.Ql,{value:R,children:"All Users"}),V.map(e=>(0,t.jsx)(k.Ql,{value:e.userId,children:e.display},e.userId))]})]})]}),(0,t.jsxs)("div",{className:"flex items-center",children:[r&&(0,t.jsxs)("div",{className:"flex items-center mr-2",children:[(0,t.jsx)(l.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,t.jsxs)("button",{onClick:()=>{C.default.invalidate(x.getClusters),C.default.invalidate(p.fX),C.default.invalidate(f.R),d.current&&d.current()},disabled:r,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,t.jsx)(j.Z,{className:"h-4 w-4 mr-1.5"}),!z&&(0,t.jsx)("span",{children:"Refresh"})]})]})]}),(0,t.jsx)(O,{refreshInterval:i.yc,setLoading:c,refreshDataRef:d,workspaceFilter:N,userFilter:M,onOpenSSHModal:e=>{y(e),h(!0)},onOpenVSCodeModal:e=>{y(e),g(!0)}}),(0,t.jsx)(w.Oh,{isOpen:u,onClose:()=>h(!1),cluster:v}),(0,t.jsx)(w._R,{isOpen:m,onClose:()=>g(!1),cluster:v})]})}function O(e){let{refreshInterval:s,setLoading:r,refreshDataRef:a,workspaceFilter:c,userFilter:p,onOpenSSHModal:f,onOpenVSCodeModal:j}=e,[g,v]=(0,n.useState)([]),[y,w]=(0,n.useState)({key:null,direction:"ascending"}),[b,k]=(0,n.useState)(!1),[S,I]=(0,n.useState)(!0),[M,O]=(0,n.useState)(1),[q,L]=(0,n.useState)(10),E=n.useCallback(async()=>{r(!0),k(!0),v(await C.default.get(x.getClusters)),r(!1),k(!1),I(!1)},[r]),V=n.useMemo(()=>{let e=g;return c&&c!==_&&(e=e.filter(e=>(e.workspace||"default").toLowerCase()===c.toLowerCase())),p&&p!==R&&(e=e.filter(e=>(e.user_hash||e.user)===p)),(0,m.R0)(e,y.key,y.direction)},[g,y,c,p]);n.useEffect(()=>{a&&(a.current=E)},[a,E]),(0,n.useEffect)(()=>{v([]);let e=!0;E();let r=setInterval(()=>{e&&E()},s);return()=>{e=!1,clearInterval(r)}},[s,E]),(0,n.useEffect)(()=>{O(1)},[g.length]);let z=e=>{let s="ascending";y.key===e&&"ascending"===y.direction&&(s="descending"),w({key:e,direction:s})},T=e=>y.key===e?"ascending"===y.direction?" ↑":" ↓":"",F=Math.ceil(V.length/q),Z=(M-1)*q,B=Z+q,H=V.slice(Z,B);return(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Zb,{children:(0,t.jsxs)(h.iA,{children:[(0,t.jsx)(h.xD,{children:(0,t.jsxs)(h.SC,{children:[(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>z("status"),children:["Status",T("status")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>z("cluster"),children:["Cluster",T("cluster")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>z("user"),children:["User",T("user")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>z("workspace"),children:["Workspace",T("workspace")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>z("infra"),children:["Infra",T("infra")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>z("resources_str"),children:["Resources",T("resources_str")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>z("time"),children:["Started",T("time")]}),(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>z("autostop"),children:["Autostop",T("autostop")]}),(0,t.jsx)(h.ss,{children:"Actions"})]})}),(0,t.jsx)(h.RM,{children:b&&S?(0,t.jsx)(h.SC,{children:(0,t.jsx)(h.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:(0,t.jsxs)("div",{className:"flex justify-center items-center",children:[(0,t.jsx)(l.Z,{size:20,className:"mr-2"}),(0,t.jsx)("span",{children:"Loading..."})]})})}):H.length>0?H.map((e,s)=>(0,t.jsxs)(h.SC,{children:[(0,t.jsx)(h.pj,{children:(0,t.jsx)(N.OE,{status:e.status})}),(0,t.jsx)(h.pj,{children:(0,t.jsx)(o(),{href:"/clusters/".concat(e.cluster),className:"text-blue-600",children:e.cluster})}),(0,t.jsx)(h.pj,{children:e.user}),(0,t.jsx)(h.pj,{children:(0,t.jsx)(o(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,t.jsx)(h.pj,{children:(0,t.jsx)(i.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,t.jsxs)("span",{children:[(0,t.jsx)(o(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud}),e.infra.includes("(")&&(0,t.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})})}),(0,t.jsx)(h.pj,{children:(0,t.jsx)(i.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,t.jsx)("span",{children:e.resources_str})})}),(0,t.jsx)(h.pj,{children:(0,i.GV)(e.time)}),(0,t.jsx)(h.pj,{children:A(e.autostop,e.to_down)}),(0,t.jsx)(h.pj,{className:"text-left",children:(0,t.jsx)(W,{cluster:e.cluster,status:e.status,onOpenSSHModal:f,onOpenVSCodeModal:j})})]},s)):(0,t.jsx)(h.SC,{children:(0,t.jsx)(h.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:"No active clusters"})})})]})}),g.length>0&&(0,t.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,t.jsxs)("div",{className:"relative inline-block",children:[(0,t.jsxs)("select",{value:q,onChange:e=>{L(parseInt(e.target.value,10)),O(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,t.jsx)("option",{value:10,children:"10"}),(0,t.jsx)("option",{value:30,children:"30"}),(0,t.jsx)("option",{value:50,children:"50"}),(0,t.jsx)("option",{value:100,children:"100"}),(0,t.jsx)("option",{value:200,children:"200"})]}),(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,t.jsxs)("div",{children:[Z+1," – ",Math.min(B,g.length)," of"," ",g.length]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(d.z,{variant:"ghost",size:"icon",onClick:()=>{O(e=>Math.max(e-1,1))},disabled:1===M,className:"text-gray-500 h-8 w-8 p-0",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,t.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,t.jsx)(d.z,{variant:"ghost",size:"icon",onClick:()=>{O(e=>Math.min(e+1,F))},disabled:M===F||0===F,className:"text-gray-500 h-8 w-8 p-0",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,t.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}let q=(e,s)=>{s&&s(e)},L=(e,s)=>{s?s(e):window.open("ssh://".concat(e))},E=e=>"RUNNING"===e?["connect","VSCode"]:[],V={connect:(0,t.jsx)(v,{className:"w-4 h-4 text-gray-500 inline-block"}),VSCode:(0,t.jsx)(y,{className:"w-4 h-4 text-gray-500 inline-block"})};function W(e){let{withLabel:s=!1,cluster:r,status:n,onOpenSSHModal:a,onOpenVSCodeModal:l}=e,c=E(n),o=(0,b.X)(),d=e=>{switch(e){case"connect":L(r,a);break;case"VSCode":q(r,l);break;default:return}};return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{className:"flex items-center space-x-4",children:Object.entries(V).map(e=>{let r,n,[a,l]=e;switch(a){case"connect":r="Connect",n="Connect with SSH";break;case"VSCode":r="VSCode",n="Open in VS Code"}return(s||(r=""),c.includes(a))?(0,t.jsx)(i.WH,{content:n,className:"capitalize text-sm text-muted-foreground",children:(0,t.jsxs)("button",{onClick:()=>d(a),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[l,!o&&(0,t.jsx)("span",{className:"ml-1.5",children:r})]})},a):(0,t.jsx)(i.WH,{content:n,className:"capitalize text-sm text-muted-foreground",children:(0,t.jsxs)("span",{className:"opacity-30 flex items-center cursor-not-allowed text-sm",title:a,children:[l,!o&&(0,t.jsx)("span",{className:"ml-1.5",children:r})]})},a)})})})}},803:function(e,s,r){r.d(s,{z:function(){return o}});var t=r(5893),n=r(7294),a=r(8426),l=r(2003),i=r(2350);let c=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),o=n.forwardRef((e,s)=>{let{className:r,variant:n,size:l,asChild:o=!1,...d}=e,u=o?a.g7:"button";return(0,t.jsx)(u,{className:(0,i.cn)(c({variant:n,size:l,className:r})),ref:s,...d})});o.displayName="Button"},7673:function(e,s,r){r.d(s,{Ol:function(){return o},Zb:function(){return c},aY:function(){return h},eW:function(){return x},ll:function(){return d}});var t=r(5893),n=r(7294),a=r(5697),l=r.n(a),i=r(2350);let c=n.forwardRef((e,s)=>{let{className:r,children:n,...a}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...a,children:n})});c.displayName="Card",c.propTypes={className:l().string,children:l().node};let o=n.forwardRef((e,s)=>{let{className:r,children:n,...a}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",r),...a,children:n})});o.displayName="CardHeader",o.propTypes={className:l().string,children:l().node};let d=n.forwardRef((e,s)=>{let{className:r,children:n,...a}=e;return(0,t.jsx)("h3",{ref:s,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",r),...a,children:n})});d.displayName="CardTitle",d.propTypes={className:l().string,children:l().node};let u=n.forwardRef((e,s)=>{let{className:r,children:n,...a}=e;return(0,t.jsx)("p",{ref:s,className:(0,i.cn)("text-sm text-muted-foreground",r),...a,children:n})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let h=n.forwardRef((e,s)=>{let{className:r,children:n,...a}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("p-6 pt-0",r),...a,children:n})});h.displayName="CardContent",h.propTypes={className:l().string,children:l().node};let x=n.forwardRef((e,s)=>{let{className:r,children:n,...a}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("flex items-center p-6 pt-0",r),...a,children:n})});x.displayName="CardFooter",x.propTypes={className:l().string,children:l().node}},2003:function(e,s,r){r.d(s,{j:function(){return l}});var t=r(512);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=t.W,l=(e,s)=>r=>{var t;if((null==s?void 0:s.variants)==null)return a(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:l,defaultVariants:i}=s,c=Object.keys(l).map(e=>{let s=null==r?void 0:r[e],t=null==i?void 0:i[e];if(null===s)return null;let a=n(s)||n(t);return l[e][a]}),o=r&&Object.entries(r).reduce((e,s)=>{let[r,t]=s;return void 0===t||(e[r]=t),e},{});return a(e,c,null==s?void 0:null===(t=s.compoundVariants)||void 0===t?void 0:t.reduce((e,s)=>{let{class:r,className:t,...n}=s;return Object.entries(n).every(e=>{let[s,r]=e;return Array.isArray(r)?r.includes({...i,...o}[s]):({...i,...o})[s]===r})?[...e,r,t]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[600,211],{3626:function(e,r,t){t.d(r,{Z:function(){return s}});/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let s=(0,t(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},3767:function(e,r,t){t.d(r,{Z:function(){return s}});/**
|
7
|
+
* @license lucide-react v0.407.0 - ISC
|
8
|
+
*
|
9
|
+
* This source code is licensed under the ISC license.
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
11
|
+
*/let s=(0,t(998).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},803:function(e,r,t){t.d(r,{z:function(){return c}});var s=t(5893),n=t(7294),a=t(8426),l=t(2003),o=t(2350);let i=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=n.forwardRef((e,r)=>{let{className:t,variant:n,size:l,asChild:c=!1,...d}=e,u=c?a.g7:"button";return(0,s.jsx)(u,{className:(0,o.cn)(i({variant:n,size:l,className:t})),ref:r,...d})});c.displayName="Button"},7673:function(e,r,t){t.d(r,{Ol:function(){return c},Zb:function(){return i},aY:function(){return m},eW:function(){return f},ll:function(){return d}});var s=t(5893),n=t(7294),a=t(5697),l=t.n(a),o=t(2350);let i=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...a,children:n})});i.displayName="Card",i.propTypes={className:l().string,children:l().node};let c=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("flex flex-col space-y-1.5 p-6",t),...a,children:n})});c.displayName="CardHeader",c.propTypes={className:l().string,children:l().node};let d=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("h3",{ref:r,className:(0,o.cn)("text-2xl font-semibold leading-none tracking-tight",t),...a,children:n})});d.displayName="CardTitle",d.propTypes={className:l().string,children:l().node};let u=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("p",{ref:r,className:(0,o.cn)("text-sm text-muted-foreground",t),...a,children:n})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let m=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("p-6 pt-0",t),...a,children:n})});m.displayName="CardContent",m.propTypes={className:l().string,children:l().node};let f=n.forwardRef((e,r)=>{let{className:t,children:n,...a}=e;return(0,s.jsx)("div",{ref:r,className:(0,o.cn)("flex items-center p-6 pt-0",t),...a,children:n})});f.displayName="CardFooter",f.propTypes={className:l().string,children:l().node}},8764:function(e,r,t){t.d(r,{RM:function(){return i},SC:function(){return c},iA:function(){return l},pj:function(){return u},ss:function(){return d},xD:function(){return o}});var s=t(5893),n=t(7294),a=t(2350);let l=n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:r,className:(0,a.cn)("w-full caption-bottom text-base",t),...n})})});l.displayName="Table";let o=n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)("thead",{ref:r,className:(0,a.cn)("[&_tr]:border-b",t),...n})});o.displayName="TableHeader";let i=n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)("tbody",{ref:r,className:(0,a.cn)("[&_tr:last-child]:border-0",t),...n})});i.displayName="TableBody",n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)("tfoot",{ref:r,className:(0,a.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...n})}).displayName="TableFooter";let c=n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)("tr",{ref:r,className:(0,a.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...n})});c.displayName="TableRow";let d=n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)("th",{ref:r,className:(0,a.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",t),...n})});d.displayName="TableHead";let u=n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)("td",{ref:r,className:(0,a.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...n})});u.displayName="TableCell",n.forwardRef((e,r)=>{let{className:t,...n}=e;return(0,s.jsx)("caption",{ref:r,className:(0,a.cn)("mt-4 text-base text-muted-foreground",t),...n})}).displayName="TableCaption"},3600:function(e,r,t){t.r(r),t.d(r,{Users:function(){return D}});var s=t(5893),n=t(7294),a=t(5697),l=t.n(a),o=t(8799),i=t(1664),c=t.n(i);t(803);var d=t(8764),u=t(3081),m=t(3266),f=t(8969),h=t(6378),x=t(6856),p=t(1214),g=t(4545),b=t(3626),y=t(282),j=t(3767);/**
|
12
|
+
* @license lucide-react v0.407.0 - ISC
|
13
|
+
*
|
14
|
+
* This source code is licensed under the ISC license.
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
16
|
+
*/let v=(0,t(998).Z)("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);t(9470);var N=t(3001),w=t(7673),C=t(7145);let k=(e,r)=>e&&e.includes("@")?e.split("@")[0]:e||"N/A",R=(e,r)=>e&&e.includes("@")?e:r||"-",I=p.nb.REFRESH_INTERVAL;function D(){let[e,r]=(0,n.useState)(!1),t=(0,n.useRef)(null),a=(0,N.X)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,s.jsx)("div",{className:"text-base",children:(0,s.jsx)(c(),{href:"/users",className:"text-sky-blue hover:underline leading-none",children:"Users"})}),(0,s.jsxs)("div",{className:"flex items-center",children:[e&&(0,s.jsxs)("div",{className:"flex items-center mr-2",children:[(0,s.jsx)(o.Z,{size:15,className:"mt-0"}),(0,s.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,s.jsxs)("button",{onClick:()=>{h.default.invalidate(u.R),h.default.invalidate(m.getClusters),h.default.invalidate(f.getManagedJobs,[{allUsers:!0}]),t.current&&t.current()},disabled:e,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,s.jsx)(b.Z,{className:"h-4 w-4 mr-1.5"}),!a&&(0,s.jsx)("span",{children:"Refresh"})]})]})]}),(0,s.jsx)(E,{refreshInterval:I,setLoading:r,refreshDataRef:t})]})}function E(e){let{refreshInterval:r,setLoading:t,refreshDataRef:a}=e,[l,i]=(0,n.useState)([]),[p,b]=(0,n.useState)(!0),[N,I]=(0,n.useState)(!1),[D,E]=(0,n.useState)({key:"username",direction:"ascending"}),[T,Z]=(0,n.useState)(null),[F,S]=(0,n.useState)(""),U=(0,n.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t&&e&&t(!0),e&&b(!0);try{let r=await h.default.get(u.R),s=(r||[]).map(e=>({...e,usernameDisplay:k(e.username,e.userId),fullEmailID:R(e.username,e.userId),clusterCount:-1,jobCount:-1}));i(s),I(!0),t&&e&&t(!1),e&&b(!1);let[n,a]=await Promise.all([h.default.get(m.getClusters),h.default.get(f.getManagedJobs,[{allUsers:!0}])]),l=a.jobs||[],o=(r||[]).map(e=>{let r=(n||[]).filter(r=>r.user_hash===e.userId),t=(l||[]).filter(r=>r.user_hash===e.userId);return{...e,usernameDisplay:k(e.username,e.userId),fullEmailID:R(e.username,e.userId),clusterCount:r.length,jobCount:t.length}});i(o)}catch(r){console.error("Failed to fetch or process user data:",r),i([]),I(!0),t&&e&&t(!1),e&&b(!1)}},[t]);(0,n.useEffect)(()=>{a&&(a.current=()=>U(!0))},[a,U]),(0,n.useEffect)(()=>{(async()=>{I(!1),b(!0),await x.ZP.preloadForPage("users"),U(!0)})();let e=setInterval(()=>{U(!1)},r);return()=>clearInterval(e)},[U,r]);let _=(0,n.useMemo)(()=>(0,g.R0)(l,D.key,D.direction),[l,D]),L=e=>{let r="ascending";D.key===e&&"ascending"===D.direction&&(r="descending"),E({key:e,direction:r})},M=e=>D.key===e?"ascending"===D.direction?" ↑":" ↓":"",z=async(e,r)=>{try{let t=await C.x.get("/users/role");if(!t.ok){let e=await t.json();throw Error(e.detail||"Failed to get user role")}let s=await t.json();console.log("data",s);let n=s.role;if("admin"!=n){alert("".concat(s.name," is logged in as no admin, cannot edit user role."));return}Z(e),S(r)}catch(e){console.error("Failed to check user role:",e),alert("Error: ".concat(e.message))}},A=()=>{Z(null),S("")},V=async e=>{if(!e||!F){console.error("User ID or role is missing."),alert("Error: User ID or role is missing.");return}b(!0);try{let r=await C.x.post("/users/update",{user_id:e,role:F});if(!r.ok){let e=await r.json();throw Error(e.detail||"Failed to update role")}h.default.invalidate(u.R),await U(!0),A()}catch(e){console.error("Failed to update user role:",e),alert("Error updating role: ".concat(e.message))}finally{b(!1)}};return p&&0===l.length&&!N?(0,s.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,s.jsx)(o.Z,{})}):N?_&&0!==_.length?(0,s.jsx)(w.Zb,{children:(0,s.jsxs)(d.iA,{children:[(0,s.jsx)(d.xD,{children:(0,s.jsxs)(d.SC,{children:[(0,s.jsxs)(d.ss,{onClick:()=>L("usernameDisplay"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Name",M("usernameDisplay")]}),(0,s.jsxs)(d.ss,{onClick:()=>L("fullEmailID"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["User ID",M("fullEmailID")]}),(0,s.jsxs)(d.ss,{onClick:()=>L("role"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Role",M("role")]}),(0,s.jsxs)(d.ss,{onClick:()=>L("clusterCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Clusters",M("clusterCount")]}),(0,s.jsxs)(d.ss,{onClick:()=>L("jobCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Jobs",M("jobCount")]})]})}),(0,s.jsx)(d.RM,{children:_.map(e=>(0,s.jsxs)(d.SC,{children:[(0,s.jsx)(d.pj,{className:"truncate",title:e.username,children:e.usernameDisplay}),(0,s.jsx)(d.pj,{className:"truncate",title:e.fullEmailID,children:e.fullEmailID}),(0,s.jsx)(d.pj,{className:"truncate",title:e.role,children:(0,s.jsx)("div",{className:"flex items-center gap-2",children:T===e.userId?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("select",{value:F,onChange:e=>S(e.target.value),className:"block w-auto p-1 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-sky-blue focus:border-sky-blue sm:text-sm",children:[(0,s.jsx)("option",{value:"admin",children:"Admin"}),(0,s.jsx)("option",{value:"user",children:"User"})]}),(0,s.jsx)("button",{onClick:()=>V(e.userId),className:"text-green-600 hover:text-green-800 p-1",title:"Save",children:(0,s.jsx)(y.Z,{className:"h-4 w-4"})}),(0,s.jsx)("button",{onClick:A,className:"text-gray-500 hover:text-gray-700 p-1",title:"Cancel",children:(0,s.jsx)(j.Z,{className:"h-4 w-4"})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"capitalize",children:e.role}),(0,s.jsx)("button",{onClick:()=>z(e.userId,e.role),className:"text-gray-400 hover:text-sky-blue p-1",title:"Edit role",children:(0,s.jsx)(v,{className:"h-3 w-3"})})]})})}),(0,s.jsx)(d.pj,{children:-1===e.clusterCount?(0,s.jsxs)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-400 rounded text-xs font-medium flex items-center",children:[(0,s.jsx)(o.Z,{size:10,className:"mr-1"}),"Loading..."]}):(0,s.jsx)(c(),{href:"/clusters?user=".concat(encodeURIComponent(e.userId)),className:"px-2 py-0.5 rounded text-xs font-medium transition-colors duration-200 cursor-pointer inline-block ".concat(e.clusterCount>0?"bg-blue-100 text-blue-800 hover:bg-blue-200 hover:text-blue-900":"bg-gray-100 text-gray-500 hover:bg-gray-200 hover:text-gray-700"),title:"View ".concat(e.clusterCount," cluster").concat(1!==e.clusterCount?"s":""," for ").concat(e.usernameDisplay),children:e.clusterCount})}),(0,s.jsx)(d.pj,{children:-1===e.jobCount?(0,s.jsxs)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-400 rounded text-xs font-medium flex items-center",children:[(0,s.jsx)(o.Z,{size:10,className:"mr-1"}),"Loading..."]}):(0,s.jsx)(c(),{href:"/jobs?user=".concat(encodeURIComponent(e.userId)),className:"px-2 py-0.5 rounded text-xs font-medium transition-colors duration-200 cursor-pointer inline-block ".concat(e.jobCount>0?"bg-green-100 text-green-800 hover:bg-green-200 hover:text-green-900":"bg-gray-100 text-gray-500 hover:bg-gray-200 hover:text-gray-700"),title:"View ".concat(e.jobCount," job").concat(1!==e.jobCount?"s":""," for ").concat(e.usernameDisplay),children:e.jobCount})})]},e.userId))})]})}):(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("p",{className:"text-lg font-semibold text-gray-500",children:"No users found."}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:"There are currently no users to display."})]}):(0,s.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,s.jsx)(o.Z,{}),(0,s.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading users..."})]})}E.propTypes={refreshInterval:l().number.isRequired,setLoading:l().func.isRequired,refreshDataRef:l().shape({current:l().func}).isRequired}},4545:function(e,r,t){function s(e){return e.startsWith("sky-jobs-controller-")}function n(e,r,t){return null===r?e:[...e].sort((e,s)=>e[r]<s[r]?"ascending"===t?-1:1:e[r]>s[r]?"ascending"===t?1:-1:0)}t.d(r,{R0:function(){return n},Ym:function(){return s}})},2003:function(e,r,t){t.d(r,{j:function(){return l}});var s=t(512);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=s.W,l=(e,r)=>t=>{var s;if((null==r?void 0:r.variants)==null)return a(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:l,defaultVariants:o}=r,i=Object.keys(l).map(e=>{let r=null==t?void 0:t[e],s=null==o?void 0:o[e];if(null===r)return null;let a=n(r)||n(s);return l[e][a]}),c=t&&Object.entries(t).reduce((e,r)=>{let[t,s]=r;return void 0===s||(e[t]=s),e},{});return a(e,i,null==r?void 0:null===(s=r.compoundVariants)||void 0===s?void 0:s.reduce((e,r)=>{let{class:t,className:s,...n}=r;return Object.entries(n).every(e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...o,...c}[r]):({...o,...c})[r]===t})?[...e,t,s]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[856],{3266:function(e,t,r){r.d(t,{QL:function(){return d},Sl:function(){return u},getClusters:function(){return c}});var a=r(7294),o=r(5821),s=r(7145),l=r(6378);let n={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function c(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return(await s.x.fetch("/status",{cluster_names:e,all_users:!0})).map(e=>{let t="",r=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let r=Math.floor((t-3)/2),a=r+(t-3)%2;return 0===r?e.substring(0,a)+"...":e.substring(0,a)+"..."+e.substring(e.length-r)}(t,25)),{status:n[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:r?"".concat(e.cloud," (").concat(r,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,autostop:e.autostop,to_down:e.to_down,jobs:[],command:e.last_creation_command||e.last_use,task_yaml:e.last_creation_yaml||"{}",events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}})}catch(e){return console.error("Error fetching clusters:",e),[]}}async function u(e){let{clusterName:t,jobId:r,onNewLog:a,workspace:l}=e;try{await s.x.stream("/logs",{follow:!1,cluster_name:t,job_id:r,override_skypilot_config:{active_workspace:l||"default"}},a)}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,o.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function i(e){let{clusterName:t,workspace:r}=e;try{return(await s.x.fetch("/queue",{cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:r}})).map(e=>{let a=e.end_at?e.end_at:Date.now()/1e3,o=0,s=0;return e.submitted_at&&(o=a-e.submitted_at),e.start_at&&(s=a-e.start_at),{id:e.job_id,status:e.status,job:e.job_name,user:e.username,gpus:e.accelerators||{},submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,resources:e.resources,cluster:t,total_duration:o,job_duration:s,infra:"",logs:"",workspace:r||"default"}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function d(e){let{cluster:t,job:r=null}=e,[o,s]=(0,a.useState)(null),[n,u]=(0,a.useState)(null),[d,g]=(0,a.useState)(!0),[f,p]=(0,a.useState)(!0),_=(0,a.useCallback)(async()=>{if(t)try{g(!0);let e=await l.default.get(c,[{clusterNames:[t]}]);return s(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{g(!1)}return null},[t]),h=(0,a.useCallback)(async e=>{if(t)try{p(!0);let r=await l.default.get(i,[{clusterName:t,workspace:e||"default"}]);u(r)}catch(e){console.error("Error fetching cluster job data:",e)}finally{p(!1)}},[t]),b=(0,a.useCallback)(async()=>{l.default.invalidate(c,[{clusterNames:[t]}]);let e=await _();e&&(l.default.invalidate(i,[{clusterName:t,workspace:e.workspace||"default"}]),await h(e.workspace))},[_,h,t]),m=(0,a.useCallback)(async()=>{o&&(l.default.invalidate(i,[{clusterName:t,workspace:o.workspace||"default"}]),await h(o.workspace))},[h,o,t]);return(0,a.useEffect)(()=>{(async()=>{let e=await _();e&&h(e.workspace)})()},[t,r,_,h]),{clusterData:o,clusterJobData:n,loading:d,clusterDetailsLoading:d,clusterJobsLoading:f,refreshData:b,refreshClusterJobsOnly:m}}},2045:function(e,t,r){r.d(t,{l4:function(){return l}});var a=r(3225),o=r(7145);async function s(e,t){try{let r=[];try{let e=await o.x.get("/enabled_clouds"),t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),a=await o.x.get("/api/get?request_id=".concat(t)),s=await a.json();r=s.return_value?JSON.parse(s.return_value):[],console.log("Enabled clouds:",r)}catch(e){console.error("Error fetching enabled clouds:",e),r=[]}let s={};a.$m.forEach(e=>{let t=r.includes(e.toLowerCase());s[e]={name:e,clusters:0,jobs:0,enabled:t}}),e.forEach(e=>{if(e.cloud){let t=e.cloud;s[t]&&(s[t].clusters+=1,s[t].enabled=!0)}}),t.forEach(e=>{if(e.cloud){let t=e.cloud;s[t]&&(s[t].jobs+=1,s[t].enabled=!0)}});let l=a.$m.length,n=Object.values(s).filter(e=>e.enabled).length;return{clouds:Object.values(s).filter(e=>e.enabled).sort((e,t)=>t.clusters-e.clusters||t.jobs-e.jobs),totalClouds:l,enabledClouds:n}}catch(e){return console.error("Error fetching cloud infrastructure:",e),{clouds:[],totalClouds:a.$m.length,enabledClouds:0}}}async function l(){let{getClusters:e}=await Promise.resolve().then(r.bind(r,3266)),{getManagedJobs:t}=await Promise.resolve().then(r.bind(r,8969)),a=(await Promise.resolve().then(r.bind(r,6378))).default,[o,l]=await Promise.all([a.get(e),a.get(t,[{allUsers:!0}])]),c=o||[],u=(null==l?void 0:l.jobs)||[],[i,d]=await Promise.all([n(c,u),s(c,u)]);return{gpuData:i,cloudData:d}}async function n(e,t){return await g({clusters:e||[],jobs:t||[]})}async function c(){try{let e=await o.x.post("/realtime_kubernetes_gpu_availability",{context:null,name_filter:null,quantity_filter:null});if(!e.ok)return console.error("Error fetching Kubernetes context GPUs (in getKubernetesContextGPUs): ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for Kubernetes GPU availability (in getKubernetesContextGPUs)"),[];let r=await o.x.get("/api/get?request_id=".concat(t)),a=await r.text();if(500===r.status){try{let e=JSON.parse(a);if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("[infra.jsx] getKubernetesContextGPUs: Server error detail:",t.message)}catch(t){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing server error JSON:",t,"Original error text:",e.detail.error)}}catch(e){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing 500 error response JSON:",e,"Raw text was:",a)}return[]}let s=JSON.parse(a);return s.return_value?JSON.parse(s.return_value):[]}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesContextGPUs:",e),[]}}async function u(){try{let e=await o.x.get("/all_contexts");if(!e.ok)return console.error("Error fetching all contexts: ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for /all_contexts"),[];let r=await o.x.get("/api/get?request_id=".concat(t)),a=await r.json();return a.return_value?JSON.parse(a.return_value):[]}catch(e){return console.error("[infra.jsx] Error in getAllContexts:",e),[]}}async function i(e){try{let t=await o.x.post("/kubernetes_node_info",{context:e}),r=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("x-request-id"),a=await o.x.get("/api/get?request_id=".concat(r));if(500===a.status){try{let e=await a.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Kubernetes per node GPUs:",t.message)}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{}}let s=await a.json();return(s.return_value?JSON.parse(s.return_value):{}).node_info_dict||{}}catch(t){return console.error("[infra.jsx] Error in getKubernetesPerNodeGPUs for context",e,":",t),{}}}async function d(e){try{let t=e.clusters,r=e.jobs,a={};return t.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(a[t]||(a[t]={clusters:0,jobs:0}),a[t].clusters+=1)}),r.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(a[t]||(a[t]={clusters:0,jobs:0}),a[t].jobs+=1)}),a}catch(e){return console.error("=== Error in getContextClustersAndJobs ===",e),{}}}async function g(e){try{let s=await u();if(!s||0===s.length)return console.log("No contexts found from /all_contexts endpoint."),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}};let l=await d(e),n=await c(),g=new Map;n&&n.forEach(e=>{g.set(e[0],e[1])});let f={},p={},_={};for(let e of s){p[e]||(p[e]=[]);let s=g.get(e);if(s&&s.length>0)for(let t of s){let r=t[0],a=t[1].join(", "),o=t[2],s=t[3];r in f?(f[r].gpu_total+=o,f[r].gpu_free+=s):f[r]={gpu_total:o,gpu_free:s,gpu_name:r},p[e].push({gpu_name:r,gpu_requestable_qty_per_node:a,gpu_total:o,gpu_free:s,context:e})}let l=await i(e);if(l&&Object.keys(l).length>0)for(let s in l){var t,r,a,o;let n=l[s],c=n.accelerator_type||"-",u=null!==(a=null===(t=n.total)||void 0===t?void 0:t.accelerator_count)&&void 0!==a?a:0,i=null!==(o=null===(r=n.free)||void 0===r?void 0:r.accelerators_available)&&void 0!==o?o:0;_["".concat(e,"/").concat(s)]={node_name:n.name,gpu_name:c,gpu_total:u,gpu_free:i,context:e},"-"===c||p[e].some(e=>e.gpu_name===c)||(c in f||(f[c]={gpu_total:0,gpu_free:0,gpu_name:c}),p[e].find(e=>e.gpu_name===c)||p[e].push({gpu_name:c,gpu_requestable_qty_per_node:"-",gpu_total:0,gpu_free:0,context:e}))}0===p[e].length&&l&&Object.keys(l).length}return{allContextNames:s.sort(),allGPUs:Object.values(f).sort((e,t)=>e.gpu_name.localeCompare(t.gpu_name)),perContextGPUs:Object.values(p).flat().sort((e,t)=>e.context.localeCompare(t.context)||e.gpu_name.localeCompare(t.gpu_name)),perNodeGPUs:Object.values(_).sort((e,t)=>e.context.localeCompare(t.context)||e.node_name.localeCompare(t.node_name)||e.gpu_name.localeCompare(t.gpu_name)),contextStats:l}}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesGPUs:",e),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}}}}},3081:function(e,t,r){r.d(t,{R:function(){return o}}),r(3266),r(8969);var a=r(7145);async function o(){try{let e=await a.x.get("/users");if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return(await e.json()).map(e=>({userId:e.id,username:e.name,role:e.role}))||[]}catch(e){return console.error("Failed to fetch users:",e),[]}}},6856:function(e,t,r){var a=r(6378),o=r(3266),s=r(8969),l=r(7324),n=r(3081),c=r(2045);let u={base:{getClusters:{fn:o.getClusters,args:[]},getManagedJobs:{fn:s.getManagedJobs,args:[{allUsers:!0}]},getWorkspaces:{fn:l.fX,args:[]},getUsers:{fn:n.R,args:[]},getInfraData:{fn:c.l4,args:[]}},dynamic:{getEnabledClouds:{fn:l.yz,requiresWorkspaces:!0}},pages:{clusters:["getClusters","getWorkspaces"],jobs:["getManagedJobs","getClusters","getWorkspaces"],infra:["getInfraData","getClusters","getManagedJobs"],workspaces:["getWorkspaces","getClusters","getManagedJobs","getEnabledClouds"],users:["getUsers","getClusters","getManagedJobs"]}};class i{async preloadForPage(e,t){let{backgroundPreload:r=!0,force:a=!1}=t||{};if(!u.pages[e]){console.warn("Unknown page: ".concat(e));return}console.log("[CachePreloader] Preloading cache for page: ".concat(e));try{await this._loadPageData(e,a),r&&this._backgroundPreloadOtherPages(e)}catch(t){console.error("[CachePreloader] Error preloading for page ".concat(e,":"),t)}}async _loadPageData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=u.pages[e],o=[];for(let e of r)if(u.base[e]){let{fn:r,args:s}=u.base[e];t&&a.default.invalidate(r,s),o.push(a.default.get(r,s))}else"getEnabledClouds"===e&&o.push(this._loadEnabledCloudsForAllWorkspaces(t));await Promise.allSettled(o),console.log("[CachePreloader] Loaded data for page: ".concat(e))}async _loadEnabledCloudsForAllWorkspaces(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&a.default.invalidate(l.fX);let t=await a.default.get(l.fX),r=Object.keys(t||{}).map(t=>(e&&a.default.invalidate(l.yz,[t]),a.default.get(l.yz,[t])));await Promise.allSettled(r)}catch(e){console.error("[CachePreloader] Error loading enabled clouds:",e)}}_backgroundPreloadOtherPages(e){if(this.isPreloading)return;this.isPreloading=!0;let t=Object.keys(u.pages).filter(t=>t!==e);console.log("[CachePreloader] Background preloading pages: ".concat(t.join(", "))),Promise.allSettled(t.map(async e=>{try{await this._loadPageData(e,!1),console.log("[CachePreloader] Background loaded: ".concat(e))}catch(t){console.error("[CachePreloader] Background load failed for ".concat(e,":"),t)}})).then(()=>{this.isPreloading=!1,console.log("[CachePreloader] Background preloading complete")})}async preloadBaseFunctions(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];console.log("[CachePreloader] Preloading all base functions");let t=Object.entries(u.base).map(t=>{let[r,{fn:o,args:s}]=t;return e&&a.default.invalidate(o,s),a.default.get(o,s).catch(e=>{console.error("[CachePreloader] Failed to preload ".concat(r,":"),e)})});await Promise.allSettled(t),console.log("[CachePreloader] Base functions preloaded")}getCacheStats(){return{...a.default.getStats(),isPreloading:this.isPreloading}}clearCache(){a.default.clear(),this.isPreloading=!1,this.preloadPromises.clear(),console.log("[CachePreloader] Cache cleared")}constructor(){this.isPreloading=!1,this.preloadPromises=new Map}}let d=new i;t.ZP=d}}]);
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[856],{3266:function(e,t,r){r.d(t,{QL:function(){return d},Sl:function(){return u},getClusters:function(){return c}});var a=r(7294),o=r(5821),s=r(7145),l=r(6378);let n={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function c(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return(await s.x.fetch("/status",{cluster_names:e,all_users:!0})).map(e=>{let t="",r=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let r=Math.floor((t-3)/2),a=r+(t-3)%2;return 0===r?e.substring(0,a)+"...":e.substring(0,a)+"..."+e.substring(e.length-r)}(t,25)),{status:n[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:r?"".concat(e.cloud," (").concat(r,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,autostop:e.autostop,to_down:e.to_down,jobs:[],command:e.last_creation_command||e.last_use,task_yaml:e.last_creation_yaml||"{}",events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}})}catch(e){return console.error("Error fetching clusters:",e),[]}}async function u(e){let{clusterName:t,jobId:r,onNewLog:a,workspace:l}=e;try{await s.x.stream("/logs",{follow:!1,cluster_name:t,job_id:r,override_skypilot_config:{active_workspace:l||"default"}},a)}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,o.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function i(e){let{clusterName:t,workspace:r}=e;try{return(await s.x.fetch("/queue",{cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:r}})).map(e=>{let a=e.end_at?e.end_at:Date.now()/1e3,o=0,s=0;return e.submitted_at&&(o=a-e.submitted_at),e.start_at&&(s=a-e.start_at),{id:e.job_id,status:e.status,job:e.job_name,user:e.username,gpus:e.accelerators||{},submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,resources:e.resources,cluster:t,total_duration:o,job_duration:s,infra:"",logs:"",workspace:r||"default"}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function d(e){let{cluster:t,job:r=null}=e,[o,s]=(0,a.useState)(null),[n,u]=(0,a.useState)(null),[d,g]=(0,a.useState)(!0),[f,p]=(0,a.useState)(!0),_=(0,a.useCallback)(async()=>{if(t)try{g(!0);let e=await l.default.get(c,[{clusterNames:[t]}]);return s(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{g(!1)}return null},[t]),h=(0,a.useCallback)(async e=>{if(t)try{p(!0);let r=await l.default.get(i,[{clusterName:t,workspace:e||"default"}]);u(r)}catch(e){console.error("Error fetching cluster job data:",e)}finally{p(!1)}},[t]),b=(0,a.useCallback)(async()=>{l.default.invalidate(c,[{clusterNames:[t]}]);let e=await _();e&&(l.default.invalidate(i,[{clusterName:t,workspace:e.workspace||"default"}]),await h(e.workspace))},[_,h,t]),m=(0,a.useCallback)(async()=>{o&&(l.default.invalidate(i,[{clusterName:t,workspace:o.workspace||"default"}]),await h(o.workspace))},[h,o,t]);return(0,a.useEffect)(()=>{(async()=>{let e=await _();e&&h(e.workspace)})()},[t,r,_,h]),{clusterData:o,clusterJobData:n,loading:d,clusterDetailsLoading:d,clusterJobsLoading:f,refreshData:b,refreshClusterJobsOnly:m}}},2045:function(e,t,r){r.d(t,{l4:function(){return l}});var a=r(3225),o=r(7145);async function s(e,t){try{let r=[];try{let e=await o.x.get("/enabled_clouds"),t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),a=await o.x.get("/api/get?request_id=".concat(t)),s=await a.json();r=s.return_value?JSON.parse(s.return_value):[],console.log("Enabled clouds:",r)}catch(e){console.error("Error fetching enabled clouds:",e),r=[]}let s={};a.$m.forEach(e=>{let t=r.includes(e.toLowerCase());s[e]={name:e,clusters:0,jobs:0,enabled:t}}),e.forEach(e=>{if(e.cloud){let t=e.cloud;s[t]&&(s[t].clusters+=1,s[t].enabled=!0)}}),t.forEach(e=>{if(e.cloud){let t=e.cloud;s[t]&&(s[t].jobs+=1,s[t].enabled=!0)}});let l=a.$m.length,n=Object.values(s).filter(e=>e.enabled).length;return{clouds:Object.values(s).filter(e=>e.enabled).sort((e,t)=>t.clusters-e.clusters||t.jobs-e.jobs),totalClouds:l,enabledClouds:n}}catch(e){return console.error("Error fetching cloud infrastructure:",e),{clouds:[],totalClouds:a.$m.length,enabledClouds:0}}}async function l(){let{getClusters:e}=await Promise.resolve().then(r.bind(r,3266)),{getManagedJobs:t}=await Promise.resolve().then(r.bind(r,8969)),a=(await Promise.resolve().then(r.bind(r,6378))).default,[o,l]=await Promise.all([a.get(e),a.get(t,[{allUsers:!0}])]),c=o||[],u=(null==l?void 0:l.jobs)||[],[i,d]=await Promise.all([n(c,u),s(c,u)]);return{gpuData:i,cloudData:d}}async function n(e,t){return await g({clusters:e||[],jobs:t||[]})}async function c(){try{let e=await o.x.post("/realtime_kubernetes_gpu_availability",{context:null,name_filter:null,quantity_filter:null});if(!e.ok)return console.error("Error fetching Kubernetes context GPUs (in getKubernetesContextGPUs): ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for Kubernetes GPU availability (in getKubernetesContextGPUs)"),[];let r=await o.x.get("/api/get?request_id=".concat(t)),a=await r.text();if(500===r.status){try{let e=JSON.parse(a);if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("[infra.jsx] getKubernetesContextGPUs: Server error detail:",t.message)}catch(t){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing server error JSON:",t,"Original error text:",e.detail.error)}}catch(e){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing 500 error response JSON:",e,"Raw text was:",a)}return[]}let s=JSON.parse(a);return s.return_value?JSON.parse(s.return_value):[]}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesContextGPUs:",e),[]}}async function u(){try{let e=await o.x.get("/all_contexts");if(!e.ok)return console.error("Error fetching all contexts: ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for /all_contexts"),[];let r=await o.x.get("/api/get?request_id=".concat(t)),a=await r.json();return a.return_value?JSON.parse(a.return_value):[]}catch(e){return console.error("[infra.jsx] Error in getAllContexts:",e),[]}}async function i(e){try{let t=await o.x.post("/kubernetes_node_info",{context:e}),r=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("x-request-id"),a=await o.x.get("/api/get?request_id=".concat(r));if(500===a.status){try{let e=await a.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Kubernetes per node GPUs:",t.message)}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{}}let s=await a.json();return(s.return_value?JSON.parse(s.return_value):{}).node_info_dict||{}}catch(t){return console.error("[infra.jsx] Error in getKubernetesPerNodeGPUs for context",e,":",t),{}}}async function d(e){try{let t=e.clusters,r=e.jobs,a={};return t.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(a[t]||(a[t]={clusters:0,jobs:0}),a[t].clusters+=1)}),r.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(a[t]||(a[t]={clusters:0,jobs:0}),a[t].jobs+=1)}),a}catch(e){return console.error("=== Error in getContextClustersAndJobs ===",e),{}}}async function g(e){try{let s=await u();if(!s||0===s.length)return console.log("No contexts found from /all_contexts endpoint."),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}};let l=await d(e),n=await c(),g=new Map;n&&n.forEach(e=>{g.set(e[0],e[1])});let f={},p={},_={};for(let e of s){p[e]||(p[e]=[]);let s=g.get(e);if(s&&s.length>0)for(let t of s){let r=t[0],a=t[1].join(", "),o=t[2],s=t[3];r in f?(f[r].gpu_total+=o,f[r].gpu_free+=s):f[r]={gpu_total:o,gpu_free:s,gpu_name:r},p[e].push({gpu_name:r,gpu_requestable_qty_per_node:a,gpu_total:o,gpu_free:s,context:e})}let l=await i(e);if(l&&Object.keys(l).length>0)for(let s in l){var t,r,a,o;let n=l[s],c=n.accelerator_type||"-",u=null!==(a=null===(t=n.total)||void 0===t?void 0:t.accelerator_count)&&void 0!==a?a:0,i=null!==(o=null===(r=n.free)||void 0===r?void 0:r.accelerators_available)&&void 0!==o?o:0;_["".concat(e,"/").concat(s)]={node_name:n.name,gpu_name:c,gpu_total:u,gpu_free:i,context:e},"-"===c||p[e].some(e=>e.gpu_name===c)||(c in f||(f[c]={gpu_total:0,gpu_free:0,gpu_name:c}),p[e].find(e=>e.gpu_name===c)||p[e].push({gpu_name:c,gpu_requestable_qty_per_node:"-",gpu_total:0,gpu_free:0,context:e}))}0===p[e].length&&l&&Object.keys(l).length}return{allContextNames:s.sort(),allGPUs:Object.values(f).sort((e,t)=>e.gpu_name.localeCompare(t.gpu_name)),perContextGPUs:Object.values(p).flat().sort((e,t)=>e.context.localeCompare(t.context)||e.gpu_name.localeCompare(t.gpu_name)),perNodeGPUs:Object.values(_).sort((e,t)=>e.context.localeCompare(t.context)||e.node_name.localeCompare(t.node_name)||e.gpu_name.localeCompare(t.gpu_name)),contextStats:l}}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesGPUs:",e),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}}}}},3081:function(e,t,r){r.d(t,{R:function(){return o}}),r(3266),r(8969);var a=r(7145);async function o(){try{let e=await a.x.get("/users");if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return(await e.json()).map(e=>({userId:e.id,username:e.name,role:e.role}))||[]}catch(e){return console.error("Failed to fetch users:",e),[]}}},6856:function(e,t,r){var a=r(6378),o=r(3266),s=r(8969),l=r(7324),n=r(3081),c=r(2045);let u={base:{getClusters:{fn:o.getClusters,args:[]},getManagedJobs:{fn:s.getManagedJobs,args:[{allUsers:!0}]},getWorkspaces:{fn:l.fX,args:[]},getUsers:{fn:n.R,args:[]},getInfraData:{fn:c.l4,args:[]}},dynamic:{getEnabledClouds:{fn:l.yz,requiresWorkspaces:!0}},pages:{clusters:["getClusters","getWorkspaces","getUsers"],jobs:["getManagedJobs","getClusters","getWorkspaces","getUsers"],infra:["getInfraData","getClusters","getManagedJobs"],workspaces:["getWorkspaces","getClusters","getManagedJobs","getEnabledClouds"],users:["getUsers","getClusters","getManagedJobs"]}};class i{async preloadForPage(e,t){let{backgroundPreload:r=!0,force:a=!1}=t||{};if(!u.pages[e]){console.warn("Unknown page: ".concat(e));return}console.log("[CachePreloader] Preloading cache for page: ".concat(e));try{await this._loadPageData(e,a),r&&this._backgroundPreloadOtherPages(e)}catch(t){console.error("[CachePreloader] Error preloading for page ".concat(e,":"),t)}}async _loadPageData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=u.pages[e],o=[];for(let e of r)if(u.base[e]){let{fn:r,args:s}=u.base[e];t&&a.default.invalidate(r,s),o.push(a.default.get(r,s))}else"getEnabledClouds"===e&&o.push(this._loadEnabledCloudsForAllWorkspaces(t));await Promise.allSettled(o),console.log("[CachePreloader] Loaded data for page: ".concat(e))}async _loadEnabledCloudsForAllWorkspaces(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&a.default.invalidate(l.fX);let t=await a.default.get(l.fX),r=Object.keys(t||{}).map(t=>(e&&a.default.invalidate(l.yz,[t]),a.default.get(l.yz,[t])));await Promise.allSettled(r)}catch(e){console.error("[CachePreloader] Error loading enabled clouds:",e)}}_backgroundPreloadOtherPages(e){if(this.isPreloading)return;this.isPreloading=!0;let t=Object.keys(u.pages).filter(t=>t!==e);console.log("[CachePreloader] Background preloading pages: ".concat(t.join(", "))),Promise.allSettled(t.map(async e=>{try{await this._loadPageData(e,!1),console.log("[CachePreloader] Background loaded: ".concat(e))}catch(t){console.error("[CachePreloader] Background load failed for ".concat(e,":"),t)}})).then(()=>{this.isPreloading=!1,console.log("[CachePreloader] Background preloading complete")})}async preloadBaseFunctions(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];console.log("[CachePreloader] Preloading all base functions");let t=Object.entries(u.base).map(t=>{let[r,{fn:o,args:s}]=t;return e&&a.default.invalidate(o,s),a.default.get(o,s).catch(e=>{console.error("[CachePreloader] Failed to preload ".concat(r,":"),e)})});await Promise.allSettled(t),console.log("[CachePreloader] Base functions preloaded")}getCacheStats(){return{...a.default.getStats(),isPreloading:this.isPreloading}}clearCache(){a.default.clear(),this.isPreloading=!1,this.preloadPromises.clear(),console.log("[CachePreloader] Cache cleared")}constructor(){this.isPreloading=!1,this.preloadPromises=new Map}}let d=new i;t.ZP=d}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[938],{938:function(e,s,t){t.r(s),t.d(s,{ClusterJobs:function(){return F},ManagedJobs:function(){return O},ManagedJobsTable:function(){return U},Status2Actions:function(){return z},filterJobsByUser:function(){return M},filterJobsByWorkspace:function(){return _},statusGroups:function(){return L}});var r=t(5893),n=t(7294),a=t(1163),l=t(1664),i=t.n(l),c=t(8799),o=t(803),d=t(7673),u=t(8764),h=t(6989),x=t(8969),m=t(3266),p=t(7324),j=t(3081);t(9470);var f=t(3626),g=t(3293),w=t(6521),b=t(3610),N=t(9284),y=t(4545),v=t(9307),k=t(3001),C=t(8950),S=t(6378),E=t(6856);let L={active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]},I="__ALL_WORKSPACES__",R="__ALL_USERS__";function _(e,s){return s&&s!==I?e.filter(e=>(e.workspace||"default").toLowerCase()===s.toLowerCase()):e}function M(e,s){return s&&s!==R?e.filter(e=>(e.user_hash||e.user)===s):e}let A=(e,s)=>{if(e&&e.includes("@")){let t=e.split("@")[0];return s&&s!==t?"".concat(t," (").concat(s,")"):t}let t=e||s||"N/A";return s&&s!==t?"".concat(t," (").concat(s,")"):t},D=e=>{if(!e)return"-";let s=e instanceof Date?e:new Date(1e3*e),t=(0,h.GV)(s);if(n.isValidElement(t)&&t.props&&t.props.children&&(t=n.isValidElement(t.props.children)&&t.props.children.props&&t.props.children.props.children?t.props.children.props.children:t.props.children),"string"!=typeof t)return t;let a=function(e){if(!e||"string"!=typeof e)return e;if("just now"===e)return"now";if("less than a minute ago"===e.toLowerCase())return"Less than a minute ago";let s=e.match(/^About\s+(\d+)\s+(\w+)\s+ago$/);if(s){let e=s[1],t=s[2],r={second:"s",seconds:"s",minute:"m",minutes:"m",hour:"h",hours:"h",day:"d",days:"d",month:"mo",months:"mo",year:"yr",years:"yr"};if(r[t])return"".concat(e).concat(r[t]," ago")}let t=e.match(/^a[n]?\s+(\w+)\s+ago$/);if(t){let e=t[1],s={second:"s",minute:"m",hour:"h",day:"d",month:"mo",year:"yr"};if(s[e])return"1".concat(s[e]," ago")}let r=e.match(/^(\d+)\s+(\w+)\s+ago$/);if(r){let e=r[1],s=r[2],t={second:"s",seconds:"s",minute:"m",minutes:"m",hour:"h",hours:"h",day:"d",days:"d",month:"mo",months:"mo",year:"yr",years:"yr"};if(t[s])return"".concat(e).concat(t[s]," ago")}return e}(t);return 7>Math.abs((new Date().getTime()-s.getTime())/864e5)?(0,r.jsx)(h.WH,{content:(0,h.o0)(s),className:"capitalize text-sm text-muted-foreground",children:a}):(0,r.jsx)(h.WH,{content:(0,h.o0)(s),className:"text-sm text-muted-foreground",children:a})};function O(){var e;let s=(0,a.useRouter)(),[t,l]=(0,n.useState)(!1),o=n.useRef(null),[d,u]=(0,n.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),m=(0,k.X)(),[g,w]=(0,n.useState)(I),[b,y]=(0,n.useState)(R),[v,L]=(0,n.useState)([]),[_,M]=(0,n.useState)([]);(0,n.useEffect)(()=>{s.isReady&&(s.query.workspace&&w(Array.isArray(s.query.workspace)?s.query.workspace[0]:s.query.workspace),s.query.user&&y(Array.isArray(s.query.user)?s.query.user[0]:s.query.user))},[s.isReady,s.query.workspace,s.query.user]);let D=(e,t)=>{let r={...s.query};e&&e!==I?r.workspace=e:delete r.workspace,t&&t!==R?r.user=t:delete r.user,s.replace({pathname:s.pathname,query:r},void 0,{shallow:!0})};return(0,n.useEffect)(()=>{(async()=>{try{await E.ZP.preloadForPage("jobs");let e=await S.default.get(p.fX),s=Object.keys(e),t=(await S.default.get(x.getManagedJobs,[{allUsers:!0}])).jobs||[],r=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],n=new Set(s);r.forEach(e=>n.add(e)),L(Array.from(n).sort());let a=await S.default.get(j.R),l=[...new Set(t.map(e=>({userId:e.user_hash||e.user,username:e.user})).filter(e=>e.userId)).values()],i=new Map;a.forEach(e=>{i.set(e.userId,{userId:e.userId,username:e.username,display:A(e.username,e.userId)})}),l.forEach(e=>{i.has(e.userId)||i.set(e.userId,{userId:e.userId,username:e.username,display:A(e.username,e.userId)})}),M(Array.from(i.values()).sort((e,s)=>e.display.localeCompare(s.display)))}catch(e){console.error("Error fetching data for filters:",e),L(["default"]),M([])}})()},[]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"}),(0,r.jsxs)(C.Ph,{value:g,onValueChange:e=>{w(e),D(e,b)},children:[(0,r.jsx)(C.i4,{className:"h-8 w-48 ml-4 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,r.jsx)(C.ki,{placeholder:"Filter by workspace...",children:g===I?"All Workspaces":g})}),(0,r.jsxs)(C.Bw,{children:[(0,r.jsx)(C.Ql,{value:I,children:"All Workspaces"}),v.map(e=>(0,r.jsx)(C.Ql,{value:e,children:e},e))]})]}),(0,r.jsxs)(C.Ph,{value:b,onValueChange:e=>{y(e),D(g,e)},children:[(0,r.jsx)(C.i4,{className:"h-8 w-48 ml-2 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,r.jsx)(C.ki,{placeholder:"Filter by user...",children:b===R?"All Users":(null===(e=_.find(e=>e.userId===b))||void 0===e?void 0:e.display)||b})}),(0,r.jsxs)(C.Bw,{children:[(0,r.jsx)(C.Ql,{value:R,children:"All Users"}),_.map(e=>(0,r.jsx)(C.Ql,{value:e.userId,children:e.display},e.userId))]})]})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[t&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(c.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,r.jsxs)("button",{onClick:()=>{S.default.invalidate(x.getManagedJobs,[{allUsers:!0}]),S.default.invalidate(p.fX),S.default.invalidate(j.R),o.current&&o.current()},disabled:t,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",title:"Refresh",children:[(0,r.jsx)(f.Z,{className:"h-4 w-4 mr-1.5"}),!m&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsx)(U,{refreshInterval:h.yc,setLoading:l,refreshDataRef:o,workspaceFilter:g,userFilter:b}),(0,r.jsx)(N.cV,{isOpen:d.isOpen,onClose:()=>u({...d,isOpen:!1}),onConfirm:d.onConfirm,title:d.title,message:d.message})]})}function U(e){let{refreshInterval:s,setLoading:t,refreshDataRef:a,workspaceFilter:l,userFilter:p}=e,[j,f]=(0,n.useState)([]),[w,b]=(0,n.useState)({key:null,direction:"ascending"}),[k,C]=(0,n.useState)(!1),[E,I]=(0,n.useState)(!0),[R,A]=(0,n.useState)(1),[O,U]=(0,n.useState)(10),[F,q]=(0,n.useState)(null),J=(0,n.useRef)(null),[T,Z]=(0,n.useState)([]),[B,V]=(0,n.useState)({}),[G,H]=(0,n.useState)(!1),[Q,X]=(0,n.useState)(!1),[$,K]=(0,n.useState)(!1),[Y,ee]=(0,n.useState)("all"),[es,et]=(0,n.useState)(!0),[er,en]=(0,n.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),ea=async()=>{en({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller?",onConfirm:async()=>{try{K(!0),C(!0),await (0,x.Ce)("restartcontroller"),await el()}catch(e){console.error("Error restarting controller:",e)}finally{K(!1),C(!1)}}})},el=n.useCallback(async()=>{C(!0),t(!0);try{let[e,s]=await Promise.all([S.default.get(x.getManagedJobs,[{allUsers:!0}]),S.default.get(m.getClusters)]),{jobs:t=[],controllerStopped:r=!1}=e||{},n=null==s?void 0:s.find(e=>(0,y.Ym)(e.cluster)),a=n?n.status:"NOT_FOUND",l=!1;"STOPPED"==a&&r&&(l=!0),"LAUNCHING"==a?X(!0):X(!1),f(t),H(l),I(!1)}catch(e){console.error("Error fetching data:",e),f([]),H(!1),I(!1)}finally{C(!1),t(!1)}},[t]);n.useEffect(()=>{a&&(a.current=el)},[a,el]),(0,n.useEffect)(()=>{f([]);let e=!0;el();let t=setInterval(()=>{e&&el()},s);return()=>{e=!1,clearInterval(t)}},[s,el]),(0,n.useEffect)(()=>{A(1)},[Y,null==j?void 0:j.length]),(0,n.useEffect)(()=>{Z([]),et(!0)},[Y]);let ei=e=>{let s="ascending";w.key===e&&"ascending"===w.direction&&(s="descending"),b({key:e,direction:s})},ec=e=>w.key===e?"ascending"===w.direction?" ↑":" ↓":"";n.useMemo(()=>{let e=j||[];return{active:e.filter(e=>L.active.includes(e.status)).length,finished:e.filter(e=>L.finished.includes(e.status)).length}},[j]);let eo=e=>T.length>0?T.includes(e):"all"===Y||L[Y].includes(e),ed=n.useMemo(()=>{let e=_(j,l);return(e=M(e,p),T.length>0)?e.filter(e=>T.includes(e.status)):es?"all"===Y?e:e.filter(e=>L[Y].includes(e.status)):[]},[j,Y,T,es,l,p]),eu=n.useMemo(()=>w.key?[...ed].sort((e,s)=>e[w.key]<s[w.key]?"ascending"===w.direction?-1:1:e[w.key]>s[w.key]?"ascending"===w.direction?1:-1:0):ed,[ed,w]),eh=Math.ceil(eu.length/O),ex=(R-1)*O,em=ex+O,ep=eu.slice(ex,em),ej=e=>{if(T.includes(e)){let s=T.filter(s=>s!==e);0===s.length?(et(!0),Z([])):(Z(s),et(!1))}else Z([...T,e]),et(!1)};return(0,n.useEffect)(()=>{V((j||[]).reduce((e,s)=>(e[s.status]=(e[s.status]||0)+1,e),{}))},[j]),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"flex flex-col space-y-1 mb-1",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center text-sm mb-1",children:[(0,r.jsx)("span",{className:"mr-2 text-sm font-medium",children:"Statuses:"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[!k&&(!j||0===j.length)&&!E&&(0,r.jsx)("span",{className:"text-gray-500 mr-2",children:"No jobs found"}),Object.entries(B).map(e=>{let[s,t]=e;return(0,r.jsxs)("button",{onClick:()=>ej(s),className:"px-3 py-1 rounded-full flex items-center space-x-2 ".concat(eo(s)||T.includes(s)?(0,v.Cl)(s):"bg-gray-50 text-gray-600 hover:bg-gray-100"),children:[(0,r.jsx)("span",{children:s}),(0,r.jsx)("span",{className:"text-xs ".concat(eo(s)||T.includes(s)?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:t})]},s)}),j&&j.length>0&&(0,r.jsxs)("div",{className:"flex items-center ml-2 gap-2",children:[(0,r.jsx)("span",{className:"text-gray-500",children:"("}),(0,r.jsx)("button",{onClick:()=>{ee("all"),Z([]),et(!0)},className:"text-sm font-medium ".concat("all"===Y&&es?"text-purple-700 underline":"text-gray-600 hover:text-purple-700 hover:underline"),children:"show all jobs"}),(0,r.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,r.jsx)("button",{onClick:()=>{ee("active"),Z([]),et(!0)},className:"text-sm font-medium ".concat("active"===Y&&es?"text-green-700 underline":"text-gray-600 hover:text-green-700 hover:underline"),children:"show all active jobs"}),(0,r.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,r.jsx)("button",{onClick:()=>{ee("finished"),Z([]),et(!0)},className:"text-sm font-medium ".concat("finished"===Y&&es?"text-blue-700 underline":"text-gray-600 hover:text-blue-700 hover:underline"),children:"show all finished jobs"}),(0,r.jsx)("span",{className:"text-gray-500",children:")"})]})]})]})}),(0,r.jsx)(d.Zb,{children:(0,r.jsxs)(u.iA,{children:[(0,r.jsx)(u.xD,{children:(0,r.jsxs)(u.SC,{children:[(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("id"),children:["ID",ec("id")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("name"),children:["Name",ec("name")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("user"),children:["User",ec("user")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("workspace"),children:["Workspace",ec("workspace")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("submitted_at"),children:["Submitted",ec("submitted_at")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("job_duration"),children:["Duration",ec("job_duration")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("status"),children:["Status",ec("status")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("priority"),children:["Priority",ec("priority")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("resources_str"),children:["Requested",ec("resources_str")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("infra"),children:["Infra",ec("infra")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("cluster"),children:["Resources",ec("cluster")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>ei("recoveries"),children:["Recoveries",ec("recoveries")]}),(0,r.jsx)(u.ss,{children:"Details"}),(0,r.jsx)(u.ss,{children:"Logs"})]})}),(0,r.jsx)(u.RM,{children:k||E?(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:13,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(c.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):ep.length>0?(0,r.jsx)(r.Fragment,{children:ep.map(e=>(0,r.jsxs)(n.Fragment,{children:[(0,r.jsxs)(u.SC,{children:[(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.name})}),(0,r.jsx)(u.pj,{children:e.user}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,r.jsx)(u.pj,{children:D(e.submitted_at)}),(0,r.jsx)(u.pj,{children:(0,h.LU)(e.job_duration)}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(v.OE,{status:e.status})}),(0,r.jsx)(u.pj,{children:e.priority}),(0,r.jsx)(u.pj,{children:e.requested_resources}),(0,r.jsx)(u.pj,{children:e.infra&&"-"!==e.infra?(0,r.jsx)(h.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(i(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud||e.infra.split("(")[0].trim()}),e.infra.includes("(")&&(0,r.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})}):(0,r.jsx)("span",{children:e.infra||"-"})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(h.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{children:e.resources_str})})}),(0,r.jsx)(u.pj,{children:e.recoveries}),(0,r.jsx)(u.pj,{children:e.details?(0,r.jsx)(P,{text:e.details,rowId:e.id,expandedRowId:F,setExpandedRowId:q}):"-"}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(z,{jobParent:"/jobs",jobId:e.id,managed:!0})})]}),F===e.id&&(0,r.jsx)(W,{text:e.details,colSpan:13,innerRef:J})]},e.id))}):(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:13,className:"text-center py-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[Q&&(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,r.jsx)("p",{className:"text-gray-700",children:"The managed job controller is launching. It will be ready shortly."}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(c.Z,{size:12,className:"mr-2"}),(0,r.jsx)("span",{className:"text-gray-500",children:"Launching..."})]})]}),!G&&!Q&&(0,r.jsx)("p",{className:"text-gray-500",children:"No active jobs"}),G&&(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,r.jsx)("p",{className:"text-gray-700",children:"The managed job controller has been stopped. Restart to check the latest job status."}),(0,r.jsx)(o.z,{variant:"outline",size:"sm",onClick:ea,className:"text-sky-blue hover:text-sky-blue-bright",disabled:k||$,children:$?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(g.Z,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})}),eu&&eu.length>0&&(0,r.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,r.jsxs)("div",{className:"relative inline-block",children:[(0,r.jsxs)("select",{value:O,onChange:e=>{U(parseInt(e.target.value,10)),A(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:30,children:"30"}),(0,r.jsx)("option",{value:50,children:"50"}),(0,r.jsx)("option",{value:100,children:"100"}),(0,r.jsx)("option",{value:200,children:"200"})]}),(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,r.jsxs)("div",{children:[ex+1," – ",Math.min(em,eu.length)," of"," ",eu.length]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{A(e=>Math.max(e-1,1))},disabled:1===R,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,r.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{A(e=>Math.min(e+1,eh))},disabled:R===eh||0===eh,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,r.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})}),(0,r.jsx)(N.cV,{isOpen:er.isOpen,onClose:()=>en({...er,isOpen:!1}),onConfirm:er.onConfirm,title:er.title,message:er.message,confirmClassName:"bg-blue-600 hover:bg-blue-700 text-white"})]})}function z(e){let{withLabel:s=!1,jobParent:t,jobId:n,managed:l}=e,i=(0,a.useRouter)(),c=(e,s)=>{e.preventDefault(),e.stopPropagation(),i.push({pathname:"".concat(t,"/").concat(n),query:{tab:s}})};return(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsx)(h.WH,{content:"View Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:e=>c(e,"logs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(w.Z,{className:"w-4 h-4"}),s&&(0,r.jsx)("span",{className:"ml-1.5",children:"Logs"})]})},"logs"),l&&(0,r.jsx)(h.WH,{content:"View Controller Logs",className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:e=>c(e,"controllerlogs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(b.Z,{className:"w-4 h-4"}),s&&(0,r.jsx)("span",{className:"ml-2",children:"Controller Logs"})]})},"controllerlogs")]})}function F(e){let{clusterName:s,clusterJobData:t,loading:a,refreshClusterJobsOnly:l,userFilter:x=null}=e,[m,p]=(0,n.useState)(null),[j,g]=(0,n.useState)({key:null,direction:"ascending"}),[w,b]=(0,n.useState)(1),[N,y]=(0,n.useState)(10),k=(0,n.useRef)(null),[C,S]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=e=>{m&&k.current&&!k.current.contains(e.target)&&p(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[m]);let E=n.useMemo(()=>{let e=t||[];return x&&x!==R&&(e=M(e,x)),e},[t,x]);(0,n.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(C)&&S(t)},[t,C]);let L=n.useMemo(()=>j.key?[...E].sort((e,s)=>e[j.key]<s[j.key]?"ascending"===j.direction?-1:1:e[j.key]>s[j.key]?"ascending"===j.direction?1:-1:0):E,[E,j]),I=e=>{let s="ascending";j.key===e&&"ascending"===j.direction&&(s="descending"),g({key:e,direction:s})},_=e=>j.key===e?"ascending"===j.direction?" ↑":" ↓":"",A=Math.ceil(L.length/N),O=(w-1)*N,U=O+N,F=L.slice(O,U);return(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)(d.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Cluster Jobs"}),(0,r.jsx)("div",{className:"flex items-center",children:l&&(0,r.jsxs)("button",{onClick:l,disabled:a,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center text-sm ml-2",children:[(0,r.jsx)(f.Z,{className:"w-4 h-4 mr-1"}),"Refresh Jobs"]})})]}),(0,r.jsxs)(u.iA,{children:[(0,r.jsx)(u.xD,{children:(0,r.jsxs)(u.SC,{children:[(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("id"),children:["ID",_("id")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("job"),children:["Name",_("job")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("user"),children:["User",_("user")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("workspace"),children:["Workspace",_("workspace")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("submitted_at"),children:["Submitted",_("submitted_at")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("job_duration"),children:["Duration",_("job_duration")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("status"),children:["Status",_("status")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("resources"),children:["Resources",_("resources")]}),(0,r.jsx)(u.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,r.jsx)(u.RM,{children:a?(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:9,className:"text-center py-12 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(c.Z,{size:24,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading cluster jobs..."})]})})}):F.length>0?F.map(e=>(0,r.jsxs)(n.Fragment,{children:[(0,r.jsxs)(u.SC,{className:m===e.id?"selected-row":"",children:[(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:e.id})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:(0,r.jsx)(P,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:m,setExpandedRowId:p})})}),(0,r.jsx)(u.pj,{children:e.user}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,r.jsx)(u.pj,{children:D(e.submitted_at)}),(0,r.jsx)(u.pj,{children:(0,h.LU)(e.job_duration)}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(v.OE,{status:e.status})}),(0,r.jsx)(u.pj,{children:e.resources}),(0,r.jsx)(u.pj,{className:"flex content-center items-center",children:(0,r.jsx)(z,{jobParent:"/clusters/".concat(s),jobId:e.id,managed:!1})})]}),m===e.id&&(0,r.jsx)(W,{text:e.job||"Unnamed job",colSpan:9,innerRef:k})]},e.id)):(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:"No jobs found"})})})]})]}),L&&L.length>0&&(0,r.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,r.jsxs)("div",{className:"relative inline-block",children:[(0,r.jsxs)("select",{value:N,onChange:e=>{y(parseInt(e.target.value,10)),b(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,r.jsx)("option",{value:5,children:"5"}),(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:20,children:"20"}),(0,r.jsx)("option",{value:50,children:"50"})]}),(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,r.jsxs)("div",{children:[O+1," – ",Math.min(U,L.length)," of"," ",L.length]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{b(e=>Math.max(e-1,1))},disabled:1===w,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,r.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{b(e=>Math.min(e+1,A))},disabled:w===A||0===A,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,r.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function W(e){let{text:s,colSpan:t,innerRef:n}=e;return(0,r.jsx)(u.SC,{className:"expanded-details",children:(0,r.jsx)(u.pj,{colSpan:t,children:(0,r.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border border-gray-200",ref:n,children:(0,r.jsx)("div",{className:"flex justify-between items-start",children:(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Full Details"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-700",style:{whiteSpace:"pre-wrap"},children:s})]})})})})})}function P(e){let{text:s,rowId:t,expandedRowId:a,setExpandedRowId:l}=e,i=s||"",c=i.length>50,o=a===t,d=c?"".concat(i.substring(0,50)):i,u=(0,n.useRef)(null);return(0,r.jsxs)("div",{className:"truncated-details relative max-w-full flex items-center",children:[(0,r.jsx)("span",{className:"truncate",children:d}),c&&(0,r.jsx)("button",{ref:u,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(o?null:t)},className:"text-blue-600 hover:text-blue-800 font-medium ml-1 flex-shrink-0","data-button-type":"show-more-less",children:o?"... show less":"... show more"})]})}}}]);
|
sky/dashboard/out/_next/static/chunks/{webpack-208a9812ab4f61c9.js → webpack-27de3d9d450d81c6.js}
RENAMED
@@ -1 +1 @@
|
|
1
|
-
!function(){"use strict";var e,t,n,r,c,o,u,a,i,f={},s={};function d(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}},r=!0;try{f[e](n,n.exports,d),r=!1}finally{r&&delete s[e]}return n.exports}d.m=f,e=[],d.O=function(t,n,r,c){if(n){c=c||0;for(var o=e.length;o>0&&e[o-1][2]>c;o--)e[o]=e[o-1];e[o]=[n,r,c];return}for(var u=1/0,o=0;o<e.length;o++){for(var n=e[o][0],r=e[o][1],c=e[o][2],a=!0,i=0;i<n.length;i++)u>=c&&Object.keys(d.O).every(function(e){return d.O[e](n[i])})?n.splice(i--,1):(a=!1,c<u&&(u=c));if(a){e.splice(o--,1);var f=r();void 0!==f&&(t=f)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var c=Object.create(null);d.r(c);var o={};t=t||[null,n({}),n([]),n(n)];for(var u=2&r&&e;"object"==typeof u&&!~t.indexOf(u);u=n(u))Object.getOwnPropertyNames(u).forEach(function(t){o[t]=function(){return e[t]}});return o.default=function(){return e},d.d(c,o),c},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return 350===e?"static/chunks/350.9e123a4551f68b0d.js":491===e?"static/chunks/491.b3d264269613fe09.js":937===e?"static/chunks/937.3759f538f11a0953.js":42===e?"static/chunks/42.d39e24467181b06b.js":682===e?"static/chunks/682.4dd5dc116f740b5f.js":211===e?"static/chunks/211.692afc57e812ae1a.js":600===e?"static/chunks/600.
|
1
|
+
!function(){"use strict";var e,t,n,r,c,o,u,a,i,f={},s={};function d(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}},r=!0;try{f[e](n,n.exports,d),r=!1}finally{r&&delete s[e]}return n.exports}d.m=f,e=[],d.O=function(t,n,r,c){if(n){c=c||0;for(var o=e.length;o>0&&e[o-1][2]>c;o--)e[o]=e[o-1];e[o]=[n,r,c];return}for(var u=1/0,o=0;o<e.length;o++){for(var n=e[o][0],r=e[o][1],c=e[o][2],a=!0,i=0;i<n.length;i++)u>=c&&Object.keys(d.O).every(function(e){return d.O[e](n[i])})?n.splice(i--,1):(a=!1,c<u&&(u=c));if(a){e.splice(o--,1);var f=r();void 0!==f&&(t=f)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var c=Object.create(null);d.r(c);var o={};t=t||[null,n({}),n([]),n(n)];for(var u=2&r&&e;"object"==typeof u&&!~t.indexOf(u);u=n(u))Object.getOwnPropertyNames(u).forEach(function(t){o[t]=function(){return e[t]}});return o.default=function(){return e},d.d(c,o),c},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return 350===e?"static/chunks/350.9e123a4551f68b0d.js":491===e?"static/chunks/491.b3d264269613fe09.js":937===e?"static/chunks/937.3759f538f11a0953.js":42===e?"static/chunks/42.d39e24467181b06b.js":682===e?"static/chunks/682.4dd5dc116f740b5f.js":211===e?"static/chunks/211.692afc57e812ae1a.js":600===e?"static/chunks/600.bd2ed8c076b720ec.js":513===e?"static/chunks/513.211357a2914a34b2.js":443===e?"static/chunks/443.b2242d0efcdf5f47.js":"static/chunks/"+e+"-"+({37:"7754056a4b503e1d",470:"4d1a5dbe58a8a2b9",616:"d6128fa9e7cae6e6",664:"047bc03493fda379",760:"a89d354797ce7af5",798:"c0525dc3f21e488d",799:"3625946b2ec2eb30",804:"4c9fc53aa74bc191",843:"5011affc9540757f",856:"c2c39c0912285e54",901:"b424d293275e1fd7",938:"245c9ac4c9e8bf15",947:"6620842ef80ae879",969:"20d54a9d998dc102",973:"c807fc34f09c7df3"})[e]+".js"},d.miniCssF=function(e){},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},c="_N_E:",d.l=function(e,t,n,o){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var u,a,i=document.getElementsByTagName("script"),f=0;f<i.length;f++){var s=i[f];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==c+n){u=s;break}}u||(a=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,d.nc&&u.setAttribute("nonce",d.nc),u.setAttribute("data-webpack",c+n),u.src=d.tu(e)),r[e]=[t];var l=function(t,n){u.onerror=u.onload=null,clearTimeout(b);var c=r[e];if(delete r[e],u.parentNode&&u.parentNode.removeChild(u),c&&c.forEach(function(e){return e(n)}),t)return t(n)},b=setTimeout(l.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=l.bind(null,u.onerror),u.onload=l.bind(null,u.onload),a&&document.head.appendChild(u)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.tt=function(){return void 0===o&&(o={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(o=trustedTypes.createPolicy("nextjs#bundler",o))),o},d.tu=function(e){return d.tt().createScriptURL(e)},d.p="/dashboard/_next/",u={272:0},d.f.j=function(e,t){var n=d.o(u,e)?u[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(272!=e){var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var c=d.p+d.u(e),o=Error();d.l(c,function(t){if(d.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;o.message="Loading chunk "+e+" failed.\n("+r+": "+c+")",o.name="ChunkLoadError",o.type=r,o.request=c,n[1](o)}},"chunk-"+e,e)}else u[e]=0}},d.O.j=function(e){return 0===u[e]},a=function(e,t){var n,r,c=t[0],o=t[1],a=t[2],i=0;if(c.some(function(e){return 0!==u[e]})){for(n in o)d.o(o,n)&&(d.m[n]=o[n]);if(a)var f=a(d)}for(e&&e(t);i<c.length;i++)r=c[i],d.o(u,r)&&u[r]&&u[r][0](),u[r]=0;return d.O(f)},(i=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(a.bind(null,0)),i.push=a.bind(null,i.push.bind(i)),d.nc=void 0}();
|