skypilot-nightly 1.0.0.dev20250814__py3-none-any.whl → 1.0.0.dev20250815__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of skypilot-nightly might be problematic. Click here for more details.
- sky/__init__.py +2 -2
- sky/adaptors/nebius.py +43 -1
- sky/backends/backend_utils.py +6 -2
- sky/backends/cloud_vm_ray_backend.py +13 -4
- sky/client/cli/command.py +22 -8
- sky/client/sdk.py +50 -0
- sky/clouds/kubernetes.py +2 -6
- sky/clouds/nebius.py +3 -1
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/I-djf3wB8zZl_bI67BOyZ/_buildManifest.js +1 -0
- sky/dashboard/out/_next/static/chunks/1141-a96678fed5043c12.js +1 -0
- sky/dashboard/out/_next/static/chunks/2350.fab69e61bac57b23.js +1 -0
- sky/dashboard/out/_next/static/chunks/3015-77d22ae2fad4071c.js +1 -0
- sky/dashboard/out/_next/static/chunks/3785.8ce85b31e5c602e9.js +1 -0
- sky/dashboard/out/_next/static/chunks/4045.b30465273dc5e468.js +21 -0
- sky/dashboard/out/_next/static/chunks/4509-fa63866741388427.js +1 -0
- sky/dashboard/out/_next/static/chunks/4676-9da7fdbde90b5549.js +10 -0
- sky/dashboard/out/_next/static/chunks/4725.68d5ce4d6bcb7991.js +1 -0
- sky/dashboard/out/_next/static/chunks/6014.d466a44b73af8348.js +6 -0
- sky/dashboard/out/_next/static/chunks/{6135-85426374db04811e.js → 6135-4b4d5e824b7f9d3c.js} +1 -1
- sky/dashboard/out/_next/static/chunks/6633-efe924b9b8136699.js +40 -0
- sky/dashboard/out/_next/static/chunks/6856-58370d8c9a79f72b.js +1 -0
- sky/dashboard/out/_next/static/chunks/6990-08b2a1cae076a943.js +1 -0
- sky/dashboard/out/_next/static/chunks/7325.b4bc99ce0892dcd5.js +6 -0
- sky/dashboard/out/_next/static/chunks/754-d0da8ab45f9509e9.js +18 -0
- sky/dashboard/out/_next/static/chunks/7557-5855617d0421ed55.js +1 -0
- sky/dashboard/out/_next/static/chunks/8310.4ae62d5937045bf3.js +31 -0
- sky/dashboard/out/_next/static/chunks/8838.e7953f42af2b0544.js +45 -0
- sky/dashboard/out/_next/static/chunks/8969-6d493b1e2fa45826.js +1 -0
- sky/dashboard/out/_next/static/chunks/{1871-980a395e92633a5c.js → 9037-f71c3c42670a4be0.js} +2 -2
- sky/dashboard/out/_next/static/chunks/9277.71481d5b2e606e33.js +51 -0
- sky/dashboard/out/_next/static/chunks/pages/{_app-c2ea34fda4f1f8c8.js → _app-ce361c6959bc2001.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/{[job]-078751bad714c017.js → [job]-6d43d6a6bd1d4c77.js} +2 -2
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-30c5954a7b1f67d7.js +16 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters-fa94c3548b5834aa.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/infra/{[context]-13d53fffc03ccb52.js → [context]-5264c5645299cde9.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/{infra-fc9222e26c8e2f0d.js → infra-83991650ae4bd083.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-ad2cd5aab787bc15.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs/pools/{[pool]-664c36eda967b1ba.js → [pool]-7d4182df6625fe10.js} +2 -7
- sky/dashboard/out/_next/static/chunks/pages/jobs-c6a6a8a737ad7e2d.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/users-d112a9b3d854abb2.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/volumes-b87fec189298a0c0.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspaces/{[name]-f72f73bcef9541dc.js → [name]-8a86ca4c98812df9.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces-74ef46fc370f7c71.js +1 -0
- sky/dashboard/out/_next/static/chunks/webpack-aba778a6d6eb496d.js +1 -0
- 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/pools/[pool].html +1 -1
- sky/dashboard/out/jobs.html +1 -1
- sky/dashboard/out/users.html +1 -1
- sky/dashboard/out/volumes.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/execution.py +13 -10
- sky/global_user_state.py +128 -1
- sky/jobs/constants.py +1 -1
- sky/jobs/scheduler.py +14 -21
- sky/jobs/server/core.py +64 -10
- sky/jobs/server/utils.py +1 -1
- sky/jobs/state.py +1 -3
- sky/jobs/utils.py +159 -8
- sky/provision/aws/config.py +19 -3
- sky/provision/aws/instance.py +2 -1
- sky/provision/nebius/utils.py +101 -86
- sky/provision/provisioner.py +13 -8
- sky/resources.py +5 -5
- sky/schemas/db/global_user_state/006_provision_log.py +41 -0
- sky/serve/replica_managers.py +123 -101
- sky/serve/serve_state.py +32 -0
- sky/serve/serve_utils.py +37 -16
- sky/serve/service.py +51 -17
- sky/server/constants.py +1 -1
- sky/server/requests/payloads.py +6 -0
- sky/server/requests/serializers/decoders.py +12 -2
- sky/server/requests/serializers/encoders.py +10 -2
- sky/server/server.py +44 -2
- sky/templates/kubernetes-ray.yml.j2 +1 -0
- sky/utils/common_utils.py +20 -0
- sky/utils/controller_utils.py +17 -4
- sky/utils/db/migration_utils.py +1 -1
- sky/utils/log_utils.py +14 -5
- sky/utils/resources_utils.py +25 -1
- sky/utils/schemas.py +3 -0
- sky/utils/ux_utils.py +36 -5
- {skypilot_nightly-1.0.0.dev20250814.dist-info → skypilot_nightly-1.0.0.dev20250815.dist-info}/METADATA +1 -1
- {skypilot_nightly-1.0.0.dev20250814.dist-info → skypilot_nightly-1.0.0.dev20250815.dist-info}/RECORD +99 -98
- sky/dashboard/out/_next/static/Y0eNlwi85qGRecLTin11y/_buildManifest.js +0 -1
- sky/dashboard/out/_next/static/chunks/1141-a8a8f1adba34c892.js +0 -11
- sky/dashboard/out/_next/static/chunks/1559-6c00e20454194859.js +0 -30
- sky/dashboard/out/_next/static/chunks/2369.fc20f0c2c8ed9fe7.js +0 -15
- sky/dashboard/out/_next/static/chunks/2641.142718b6b78a6f9b.js +0 -1
- sky/dashboard/out/_next/static/chunks/3785.6003d293cb83eab4.js +0 -1
- sky/dashboard/out/_next/static/chunks/4725.29550342bd53afd8.js +0 -1
- sky/dashboard/out/_next/static/chunks/4937.a2baa2df5572a276.js +0 -15
- sky/dashboard/out/_next/static/chunks/6212-7bd06f60ba693125.js +0 -13
- sky/dashboard/out/_next/static/chunks/6601-06114c982db410b6.js +0 -1
- sky/dashboard/out/_next/static/chunks/691.5eeedf82cc243343.js +0 -55
- sky/dashboard/out/_next/static/chunks/6990-0f886f16e0d55ff8.js +0 -1
- sky/dashboard/out/_next/static/chunks/8056-5bdeda81199c0def.js +0 -1
- sky/dashboard/out/_next/static/chunks/8252.62b0d23aed618bb2.js +0 -16
- sky/dashboard/out/_next/static/chunks/8969-c9686994ddafcf01.js +0 -1
- sky/dashboard/out/_next/static/chunks/9159-11421c0f2909236f.js +0 -1
- sky/dashboard/out/_next/static/chunks/9360.85b0b1b4054574dd.js +0 -31
- sky/dashboard/out/_next/static/chunks/9666.cd4273f2a5c5802c.js +0 -1
- sky/dashboard/out/_next/static/chunks/9847.757720f3b40c0aa5.js +0 -30
- sky/dashboard/out/_next/static/chunks/9984.c5564679e467d245.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-da9cc0901349c2e9.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters-b30460f683e6ba96.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-154f55cf8af55be5.js +0 -11
- sky/dashboard/out/_next/static/chunks/pages/jobs-cdc60fb5d371e16a.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/users-7ed36e44e779d5c7.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/volumes-c9695d657f78b5dc.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces-8f67be60165724cc.js +0 -1
- sky/dashboard/out/_next/static/chunks/webpack-00c0a51d21157453.js +0 -1
- /sky/dashboard/out/_next/static/{Y0eNlwi85qGRecLTin11y → I-djf3wB8zZl_bI67BOyZ}/_ssgManifest.js +0 -0
- /sky/dashboard/out/_next/static/chunks/{6989-37611fe6b86d274d.js → 6989-01359c57e018caa4.js} +0 -0
- {skypilot_nightly-1.0.0.dev20250814.dist-info → skypilot_nightly-1.0.0.dev20250815.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250814.dist-info → skypilot_nightly-1.0.0.dev20250815.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250814.dist-info → skypilot_nightly-1.0.0.dev20250815.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250814.dist-info → skypilot_nightly-1.0.0.dev20250815.dist-info}/top_level.txt +0 -0
sky/__init__.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import Optional
|
|
|
5
5
|
import urllib.request
|
|
6
6
|
|
|
7
7
|
# Replaced with the current commit when building the wheels.
|
|
8
|
-
_SKYPILOT_COMMIT_SHA = '
|
|
8
|
+
_SKYPILOT_COMMIT_SHA = '83f7c60583fed1ee759f73a5cf859239f86fb3f9'
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def _get_git_commit():
|
|
@@ -35,7 +35,7 @@ def _get_git_commit():
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
__commit__ = _get_git_commit()
|
|
38
|
-
__version__ = '1.0.0.
|
|
38
|
+
__version__ = '1.0.0.dev20250815'
|
|
39
39
|
__root_dir__ = os.path.dirname(os.path.abspath(__file__))
|
|
40
40
|
|
|
41
41
|
|
sky/adaptors/nebius.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"""Nebius cloud adaptor."""
|
|
2
|
+
import asyncio
|
|
2
3
|
import os
|
|
3
4
|
import threading
|
|
4
|
-
from typing import List, Optional
|
|
5
|
+
from typing import Any, Awaitable, List, Optional
|
|
5
6
|
|
|
6
7
|
from sky import sky_logging
|
|
7
8
|
from sky import skypilot_config
|
|
@@ -9,8 +10,49 @@ from sky.adaptors import common
|
|
|
9
10
|
from sky.utils import annotations
|
|
10
11
|
from sky.utils import ux_utils
|
|
11
12
|
|
|
13
|
+
# Default read timeout for nebius SDK
|
|
14
|
+
READ_TIMEOUT = 10
|
|
15
|
+
|
|
12
16
|
logger = sky_logging.init_logger(__name__)
|
|
13
17
|
|
|
18
|
+
_loop_lock = threading.Lock()
|
|
19
|
+
_loop = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _get_event_loop() -> asyncio.AbstractEventLoop:
|
|
23
|
+
"""Get event loop for nebius sdk."""
|
|
24
|
+
global _loop
|
|
25
|
+
|
|
26
|
+
if _loop is not None:
|
|
27
|
+
return _loop
|
|
28
|
+
|
|
29
|
+
with _loop_lock:
|
|
30
|
+
if _loop is None:
|
|
31
|
+
# Create a new event loop in a dedicated thread
|
|
32
|
+
_loop = asyncio.new_event_loop()
|
|
33
|
+
threading.Thread(target=_loop.run_forever, daemon=True).start()
|
|
34
|
+
|
|
35
|
+
return _loop
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def sync_call(awaitable: Awaitable[Any]) -> Any:
|
|
39
|
+
"""Synchronously run an awaitable in coroutine.
|
|
40
|
+
|
|
41
|
+
This wrapper is used to workaround:
|
|
42
|
+
https://github.com/nebius/pysdk/issues/76
|
|
43
|
+
|
|
44
|
+
Uses a dedicated background event loop to avoid conflicts
|
|
45
|
+
with existing asyncio contexts and prevent BlockingIOError.
|
|
46
|
+
"""
|
|
47
|
+
loop = _get_event_loop()
|
|
48
|
+
future = asyncio.run_coroutine_threadsafe(_coro(awaitable), loop)
|
|
49
|
+
return future.result()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
async def _coro(awaitable: Awaitable[Any]) -> Any:
|
|
53
|
+
"""Wrapper coroutine for awaitable."""
|
|
54
|
+
return await awaitable
|
|
55
|
+
|
|
14
56
|
|
|
15
57
|
def tenant_id_path() -> str:
|
|
16
58
|
return '~/.nebius/NEBIUS_TENANT_ID.txt'
|
sky/backends/backend_utils.py
CHANGED
|
@@ -2137,7 +2137,7 @@ def _update_cluster_status(cluster_name: str) -> Optional[Dict[str, Any]]:
|
|
|
2137
2137
|
global_user_state.add_cluster_event(
|
|
2138
2138
|
cluster_name,
|
|
2139
2139
|
status_lib.ClusterStatus.UP,
|
|
2140
|
-
'All nodes up
|
|
2140
|
+
'All nodes up; SkyPilot runtime healthy.',
|
|
2141
2141
|
global_user_state.ClusterEventType.STATUS_CHANGE,
|
|
2142
2142
|
nop_if_duplicate=True)
|
|
2143
2143
|
global_user_state.add_or_update_cluster(cluster_name,
|
|
@@ -2329,10 +2329,14 @@ def _update_cluster_status(cluster_name: str) -> Optional[Dict[str, Any]]:
|
|
|
2329
2329
|
# are only stored for an hour by default), so it is possible that
|
|
2330
2330
|
# the previous event has a status reason, but now it does not.
|
|
2331
2331
|
init_reason_regex = f'^Cluster is abnormal because {init_reason} .*'
|
|
2332
|
+
log_message = f'Cluster is abnormal because {init_reason}'
|
|
2333
|
+
if status_reason:
|
|
2334
|
+
log_message += f' ({status_reason})'
|
|
2335
|
+
log_message += '. Transitioned to INIT.'
|
|
2332
2336
|
global_user_state.add_cluster_event(
|
|
2333
2337
|
cluster_name,
|
|
2334
2338
|
status_lib.ClusterStatus.INIT,
|
|
2335
|
-
|
|
2339
|
+
log_message,
|
|
2336
2340
|
global_user_state.ClusterEventType.STATUS_CHANGE,
|
|
2337
2341
|
nop_if_duplicate=True,
|
|
2338
2342
|
duplicate_regex=init_reason_regex)
|
|
@@ -1368,8 +1368,11 @@ class RetryingVmProvisioner(object):
|
|
|
1368
1368
|
if not dryrun:
|
|
1369
1369
|
os.makedirs(os.path.expanduser(self.log_dir), exist_ok=True)
|
|
1370
1370
|
os.system(f'touch {log_path}')
|
|
1371
|
+
|
|
1371
1372
|
rich_utils.force_update_status(
|
|
1372
|
-
ux_utils.spinner_message('Launching',
|
|
1373
|
+
ux_utils.spinner_message('Launching',
|
|
1374
|
+
log_path,
|
|
1375
|
+
cluster_name=cluster_name))
|
|
1373
1376
|
|
|
1374
1377
|
# Get previous cluster status
|
|
1375
1378
|
cluster_exists = prev_cluster_status is not None
|
|
@@ -1539,6 +1542,7 @@ class RetryingVmProvisioner(object):
|
|
|
1539
1542
|
requested_resources=requested_resources,
|
|
1540
1543
|
ready=False,
|
|
1541
1544
|
is_managed=self._is_managed,
|
|
1545
|
+
provision_log_path=log_abs_path,
|
|
1542
1546
|
)
|
|
1543
1547
|
|
|
1544
1548
|
# Add cluster event for actual provisioning start.
|
|
@@ -1684,7 +1688,9 @@ class RetryingVmProvisioner(object):
|
|
|
1684
1688
|
config_dict['handle'] = handle
|
|
1685
1689
|
logger.info(
|
|
1686
1690
|
ux_utils.finishing_message(
|
|
1687
|
-
f'Cluster launched: {cluster_name!r}.',
|
|
1691
|
+
f'Cluster launched: {cluster_name!r}.',
|
|
1692
|
+
log_path,
|
|
1693
|
+
cluster_name=cluster_name))
|
|
1688
1694
|
return config_dict
|
|
1689
1695
|
|
|
1690
1696
|
# The cluster is not ready. We must perform error recording and/or
|
|
@@ -1818,7 +1824,8 @@ class RetryingVmProvisioner(object):
|
|
|
1818
1824
|
log_abs_path,
|
|
1819
1825
|
stream_logs=False,
|
|
1820
1826
|
start_streaming_at='Shared connection to',
|
|
1821
|
-
line_processor=log_utils.RayUpLineProcessor(
|
|
1827
|
+
line_processor=log_utils.RayUpLineProcessor(
|
|
1828
|
+
log_abs_path, cluster_name=cluster_handle.cluster_name),
|
|
1822
1829
|
# Reduce BOTO_MAX_RETRIES from 12 to 5 to avoid long hanging
|
|
1823
1830
|
# time during 'ray up' if insufficient capacity occurs.
|
|
1824
1831
|
env=dict(
|
|
@@ -3120,7 +3127,9 @@ class CloudVmRayBackend(backends.Backend['CloudVmRayResourceHandle']):
|
|
|
3120
3127
|
is_managed=self._is_managed)
|
|
3121
3128
|
log_path = os.path.join(self.log_dir, 'provision.log')
|
|
3122
3129
|
rich_utils.force_update_status(
|
|
3123
|
-
ux_utils.spinner_message('Launching',
|
|
3130
|
+
ux_utils.spinner_message('Launching',
|
|
3131
|
+
log_path,
|
|
3132
|
+
cluster_name=cluster_name))
|
|
3124
3133
|
config_dict = retry_provisioner.provision_with_retries(
|
|
3125
3134
|
task, to_provision_config, dryrun, stream_logs,
|
|
3126
3135
|
skip_unnecessary_provisioning)
|
sky/client/cli/command.py
CHANGED
|
@@ -2171,6 +2171,10 @@ def queue(clusters: List[str], skip_finished: bool, all_users: bool):
|
|
|
2171
2171
|
|
|
2172
2172
|
@cli.command()
|
|
2173
2173
|
@flags.config_option(expose_value=False)
|
|
2174
|
+
@click.option('--provision',
|
|
2175
|
+
is_flag=True,
|
|
2176
|
+
default=False,
|
|
2177
|
+
help='Stream the cluster provisioning logs (provision.log).')
|
|
2174
2178
|
@click.option(
|
|
2175
2179
|
'--sync-down',
|
|
2176
2180
|
'-s',
|
|
@@ -2207,6 +2211,7 @@ def queue(clusters: List[str], skip_finished: bool, all_users: bool):
|
|
|
2207
2211
|
def logs(
|
|
2208
2212
|
cluster: str,
|
|
2209
2213
|
job_ids: Tuple[str, ...],
|
|
2214
|
+
provision: bool,
|
|
2210
2215
|
sync_down: bool,
|
|
2211
2216
|
status: bool, # pylint: disable=redefined-outer-name
|
|
2212
2217
|
follow: bool,
|
|
@@ -2236,6 +2241,11 @@ def logs(
|
|
|
2236
2241
|
4. If the job fails or fetching the logs fails, the command will exit with
|
|
2237
2242
|
a non-zero return code.
|
|
2238
2243
|
"""
|
|
2244
|
+
if provision and (sync_down or status or job_ids):
|
|
2245
|
+
raise click.UsageError(
|
|
2246
|
+
'--provision cannot be combined with job log options '
|
|
2247
|
+
'(--sync-down/--status/job IDs).')
|
|
2248
|
+
|
|
2239
2249
|
if sync_down and status:
|
|
2240
2250
|
raise click.UsageError(
|
|
2241
2251
|
'Both --sync_down and --status are specified '
|
|
@@ -2248,6 +2258,10 @@ def logs(
|
|
|
2248
2258
|
|
|
2249
2259
|
job_ids = None if not job_ids else job_ids
|
|
2250
2260
|
|
|
2261
|
+
if provision:
|
|
2262
|
+
# Stream provision logs
|
|
2263
|
+
sys.exit(sdk.tail_provision_logs(cluster, follow=follow, tail=tail))
|
|
2264
|
+
|
|
2251
2265
|
if sync_down:
|
|
2252
2266
|
with rich_utils.client_status(
|
|
2253
2267
|
ux_utils.spinner_message('Downloading logs')):
|
|
@@ -4786,7 +4800,7 @@ def pool():
|
|
|
4786
4800
|
type=str,
|
|
4787
4801
|
nargs=-1,
|
|
4788
4802
|
**_get_shell_complete_args(_complete_file_name))
|
|
4789
|
-
@click.option('--pool
|
|
4803
|
+
@click.option('--pool',
|
|
4790
4804
|
'-p',
|
|
4791
4805
|
default=None,
|
|
4792
4806
|
type=str,
|
|
@@ -4808,7 +4822,7 @@ def pool():
|
|
|
4808
4822
|
@usage_lib.entrypoint
|
|
4809
4823
|
def jobs_pool_apply(
|
|
4810
4824
|
pool_yaml: Tuple[str, ...],
|
|
4811
|
-
|
|
4825
|
+
pool: Optional[str], # pylint: disable=redefined-outer-name
|
|
4812
4826
|
workdir: Optional[str],
|
|
4813
4827
|
infra: Optional[str],
|
|
4814
4828
|
cloud: Optional[str],
|
|
@@ -4841,11 +4855,11 @@ def jobs_pool_apply(
|
|
|
4841
4855
|
"""
|
|
4842
4856
|
cloud, region, zone = _handle_infra_cloud_region_zone_options(
|
|
4843
4857
|
infra, cloud, region, zone)
|
|
4844
|
-
if
|
|
4845
|
-
|
|
4858
|
+
if pool is None:
|
|
4859
|
+
pool = serve_lib.generate_service_name(pool=True)
|
|
4846
4860
|
|
|
4847
4861
|
task = _generate_task_with_service(
|
|
4848
|
-
service_name=
|
|
4862
|
+
service_name=pool,
|
|
4849
4863
|
service_yaml_args=pool_yaml,
|
|
4850
4864
|
workdir=workdir,
|
|
4851
4865
|
cloud=cloud,
|
|
@@ -4882,7 +4896,7 @@ def jobs_pool_apply(
|
|
|
4882
4896
|
dag.add(task)
|
|
4883
4897
|
|
|
4884
4898
|
request_id = managed_jobs.pool_apply(task,
|
|
4885
|
-
|
|
4899
|
+
pool,
|
|
4886
4900
|
mode=serve_lib.UpdateMode(mode),
|
|
4887
4901
|
_need_confirmation=not yes)
|
|
4888
4902
|
_async_call_or_wait(request_id, async_call, 'sky.jobs.pool_apply')
|
|
@@ -5120,7 +5134,7 @@ def _handle_serve_logs(
|
|
|
5120
5134
|
@usage_lib.entrypoint
|
|
5121
5135
|
# TODO(tian): Add default argument for this CLI if none of the flags are
|
|
5122
5136
|
# specified.
|
|
5123
|
-
def
|
|
5137
|
+
def jobs_pool_logs(
|
|
5124
5138
|
pool_name: str,
|
|
5125
5139
|
follow: bool,
|
|
5126
5140
|
controller: bool,
|
|
@@ -6037,7 +6051,7 @@ def api_logs(request_id: Optional[str], server_logs: bool,
|
|
|
6037
6051
|
# server accepts log_path-only streaming.
|
|
6038
6052
|
req_id = (server_common.RequestId[None](request_id)
|
|
6039
6053
|
if request_id is not None else None)
|
|
6040
|
-
sdk.stream_and_get(req_id, log_path, tail, follow
|
|
6054
|
+
sdk.stream_and_get(req_id, log_path, tail, follow)
|
|
6041
6055
|
|
|
6042
6056
|
|
|
6043
6057
|
@api.command('cancel', cls=_DocumentedCodeCommand)
|
sky/client/sdk.py
CHANGED
|
@@ -855,6 +855,56 @@ def tail_logs(cluster_name: str,
|
|
|
855
855
|
resumable=(tail == 0))
|
|
856
856
|
|
|
857
857
|
|
|
858
|
+
@usage_lib.entrypoint
|
|
859
|
+
@server_common.check_server_healthy_or_start
|
|
860
|
+
@versions.minimal_api_version(17)
|
|
861
|
+
@annotations.client_api
|
|
862
|
+
@rest.retry_transient_errors()
|
|
863
|
+
def tail_provision_logs(cluster_name: str,
|
|
864
|
+
follow: bool = True,
|
|
865
|
+
tail: int = 0,
|
|
866
|
+
output_stream: Optional['io.TextIOBase'] = None) -> int:
|
|
867
|
+
"""Tails the provisioning logs (provision.log) for a cluster.
|
|
868
|
+
|
|
869
|
+
Args:
|
|
870
|
+
cluster_name: name of the cluster.
|
|
871
|
+
follow: follow the logs.
|
|
872
|
+
tail: lines from end to tail.
|
|
873
|
+
output_stream: optional stream to write logs.
|
|
874
|
+
Returns:
|
|
875
|
+
Exit code 0 on streaming success; raises on HTTP error.
|
|
876
|
+
"""
|
|
877
|
+
body = payloads.ClusterNameBody(cluster_name=cluster_name)
|
|
878
|
+
params = {
|
|
879
|
+
'follow': str(follow).lower(),
|
|
880
|
+
'tail': tail,
|
|
881
|
+
}
|
|
882
|
+
response = server_common.make_authenticated_request(
|
|
883
|
+
'POST',
|
|
884
|
+
'/provision_logs',
|
|
885
|
+
json=json.loads(body.model_dump_json()),
|
|
886
|
+
params=params,
|
|
887
|
+
stream=True,
|
|
888
|
+
timeout=(client_common.API_SERVER_REQUEST_CONNECTION_TIMEOUT_SECONDS,
|
|
889
|
+
None))
|
|
890
|
+
# Log request is idempotent when tail is 0, thus can resume previous
|
|
891
|
+
# streaming point on retry.
|
|
892
|
+
# request_id=None here because /provision_logs does not create an async
|
|
893
|
+
# request. Instead, it streams a plain file from the server. This does NOT
|
|
894
|
+
# violate the stream_response doc warning about None in multi-user
|
|
895
|
+
# environments: we are not asking stream_response to select “the latest
|
|
896
|
+
# request”. We already have the HTTP response to stream; request_id=None
|
|
897
|
+
# merely disables the follow-up GET. It is also necessary for --no-follow
|
|
898
|
+
# to return cleanly after printing the tailed lines. If we provided a
|
|
899
|
+
# non-None request_id here, the get(request_id) in stream_response(
|
|
900
|
+
# would fail since /provision_logs does not create a request record.
|
|
901
|
+
stream_response(request_id=None,
|
|
902
|
+
response=response,
|
|
903
|
+
output_stream=output_stream,
|
|
904
|
+
resumable=(tail == 0))
|
|
905
|
+
return 0
|
|
906
|
+
|
|
907
|
+
|
|
858
908
|
@usage_lib.entrypoint
|
|
859
909
|
@server_common.check_server_healthy_or_start
|
|
860
910
|
@annotations.client_api
|
sky/clouds/kubernetes.py
CHANGED
|
@@ -3,7 +3,6 @@ import os
|
|
|
3
3
|
import re
|
|
4
4
|
import subprocess
|
|
5
5
|
import tempfile
|
|
6
|
-
import typing
|
|
7
6
|
from typing import Dict, Iterator, List, Optional, Set, Tuple, Union
|
|
8
7
|
|
|
9
8
|
import colorama
|
|
@@ -11,6 +10,7 @@ import colorama
|
|
|
11
10
|
from sky import catalog
|
|
12
11
|
from sky import clouds
|
|
13
12
|
from sky import exceptions
|
|
13
|
+
from sky import resources as resources_lib
|
|
14
14
|
from sky import sky_logging
|
|
15
15
|
from sky import skypilot_config
|
|
16
16
|
from sky.adaptors import kubernetes
|
|
@@ -31,10 +31,6 @@ from sky.utils import resources_utils
|
|
|
31
31
|
from sky.utils import schemas
|
|
32
32
|
from sky.utils import volume as volume_lib
|
|
33
33
|
|
|
34
|
-
if typing.TYPE_CHECKING:
|
|
35
|
-
# Renaming to avoid shadowing variables.
|
|
36
|
-
from sky import resources as resources_lib
|
|
37
|
-
|
|
38
34
|
logger = sky_logging.init_logger(__name__)
|
|
39
35
|
|
|
40
36
|
# Namespace for SkyPilot resources shared across multiple tenants on the
|
|
@@ -773,7 +769,7 @@ class Kubernetes(clouds.Cloud):
|
|
|
773
769
|
|
|
774
770
|
@staticmethod
|
|
775
771
|
def _warn_on_disk_size(resources: 'resources_lib.Resources'):
|
|
776
|
-
if resources.disk_size
|
|
772
|
+
if resources.disk_size != resources_lib.DEFAULT_DISK_SIZE_GB:
|
|
777
773
|
logger.info(f'{colorama.Style.DIM}Disk size {resources.disk_size} '
|
|
778
774
|
'is not supported by Kubernetes. '
|
|
779
775
|
'To add additional disk, use volumes.'
|
sky/clouds/nebius.py
CHANGED
|
@@ -442,7 +442,9 @@ class Nebius(clouds.Cloud):
|
|
|
442
442
|
del workspace_config # Unused
|
|
443
443
|
sdk = nebius.sdk()
|
|
444
444
|
profile_client = nebius.iam().ProfileServiceClient(sdk)
|
|
445
|
-
profile =
|
|
445
|
+
profile = nebius.sync_call(
|
|
446
|
+
profile_client.get(nebius.iam().GetProfileRequest(),
|
|
447
|
+
timeout=nebius.READ_TIMEOUT))
|
|
446
448
|
if profile.user_profile is not None:
|
|
447
449
|
if profile.user_profile.attributes is None:
|
|
448
450
|
raise exceptions.CloudUserIdentityError(
|
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/4614e06482d7309e.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/4614e06482d7309e.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-
|
|
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/4614e06482d7309e.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/4614e06482d7309e.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-aba778a6d6eb496d.js" defer=""></script><script src="/dashboard/_next/static/chunks/framework-cf60a09ccd051a10.js" defer=""></script><script src="/dashboard/_next/static/chunks/main-f15ccb73239a3bf1.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_app-ce361c6959bc2001.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-c66a4e8afc46f17b.js" defer=""></script><script src="/dashboard/_next/static/I-djf3wB8zZl_bI67BOyZ/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/I-djf3wB8zZl_bI67BOyZ/_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":"I-djf3wB8zZl_bI67BOyZ","assetPrefix":"/dashboard","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
self.__BUILD_MANIFEST=function(s,c,a,e,t,u,n,f,o,j,b,i,r,k){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static/chunks/pages/index-444f1804401f04ea.js"],"/_error":["static/chunks/pages/_error-c66a4e8afc46f17b.js"],"/clusters":["static/chunks/pages/clusters-fa94c3548b5834aa.js"],"/clusters/[cluster]":[s,c,a,u,n,"static/chunks/4676-9da7fdbde90b5549.js",j,e,t,f,b,o,i,"static/chunks/6856-58370d8c9a79f72b.js",r,k,"static/chunks/9037-f71c3c42670a4be0.js","static/chunks/pages/clusters/[cluster]-30c5954a7b1f67d7.js"],"/clusters/[cluster]/[job]":[s,c,a,u,e,t,o,"static/chunks/pages/clusters/[cluster]/[job]-6d43d6a6bd1d4c77.js"],"/config":["static/chunks/pages/config-dfb9bf07b13045f4.js"],"/infra":["static/chunks/pages/infra-83991650ae4bd083.js"],"/infra/[context]":["static/chunks/pages/infra/[context]-5264c5645299cde9.js"],"/jobs":["static/chunks/pages/jobs-c6a6a8a737ad7e2d.js"],"/jobs/pools/[pool]":[s,c,a,n,j,e,t,f,"static/chunks/pages/jobs/pools/[pool]-7d4182df6625fe10.js"],"/jobs/[job]":[s,c,a,u,n,j,e,t,f,o,"static/chunks/pages/jobs/[job]-ad2cd5aab787bc15.js"],"/users":["static/chunks/pages/users-d112a9b3d854abb2.js"],"/volumes":["static/chunks/pages/volumes-b87fec189298a0c0.js"],"/workspace/new":["static/chunks/pages/workspace/new-3f88a1c7e86a3f86.js"],"/workspaces":["static/chunks/pages/workspaces-74ef46fc370f7c71.js"],"/workspaces/[name]":[s,c,a,u,n,"static/chunks/6633-efe924b9b8136699.js",e,t,f,b,o,i,r,k,"static/chunks/1141-a96678fed5043c12.js","static/chunks/pages/workspaces/[name]-8a86ca4c98812df9.js"],sortedPages:["/","/_app","/_error","/clusters","/clusters/[cluster]","/clusters/[cluster]/[job]","/config","/infra","/infra/[context]","/jobs","/jobs/pools/[pool]","/jobs/[job]","/users","/volumes","/workspace/new","/workspaces","/workspaces/[name]"]}}("static/chunks/616-3d59f75e2ccf9321.js","static/chunks/6130-2be46d70a38f1e82.js","static/chunks/5739-d67458fcb1386c92.js","static/chunks/6989-01359c57e018caa4.js","static/chunks/3850-ff4a9a69d978632b.js","static/chunks/7411-b15471acd2cba716.js","static/chunks/1272-1ef0bf0237faccdb.js","static/chunks/8969-6d493b1e2fa45826.js","static/chunks/6135-4b4d5e824b7f9d3c.js","static/chunks/754-d0da8ab45f9509e9.js","static/chunks/6990-08b2a1cae076a943.js","static/chunks/4509-fa63866741388427.js","static/chunks/7557-5855617d0421ed55.js","static/chunks/3015-77d22ae2fad4071c.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1141],{1812:function(e,s,r){r.d(s,{X:function(){return n}});var l=r(85893),t=r(67294);let a=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},n=e=>{let{error:s,title:r="Error",onDismiss:n}=e,[c,i]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s&&i(!1)},[s]),!s||c)return null;let o="string"==typeof s?s:a(s);return(0,l.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,l.jsx)("div",{className:"ml-3",children:(0,l.jsxs)("div",{className:"text-sm text-red-800",children:[(0,l.jsxs)("strong",{children:[r,":"]})," ",o]})})]}),(0,l.jsx)("button",{onClick:()=>{i(!0),n&&n()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,l.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,l.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},69123:function(e,s,r){r.d(s,{g:function(){return n}});var l=r(85893),t=r(67294),a=r(32350);let n=t.forwardRef((e,s)=>{let{className:r,...t}=e;return(0,l.jsx)("textarea",{className:(0,a.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:s,...t})});n.displayName="Textarea"},11141:function(e,s,r){r.r(s),r.d(s,{WorkspaceEditor:function(){return _}});var l=r(85893),t=r(67294),a=r(11163),n=r(17324),c=r(23266),i=r(68969);r(6135);var o=r(41664),d=r.n(o),u=r(9008),x=r.n(u),m=r(37673),h=r(30803),f=r(69123),g=r(55739),p=r(70282),b=r(6021),j=r(13626),y=r(98418),N=r(99333),w=r(50326);let v=e=>{let{className:s="",variant:r="default",children:t,...a}=e;return(0,l.jsx)("div",{role:"alert",className:"".concat("relative w-full rounded-lg border p-4 flex items-start space-x-2"," ").concat({default:"bg-blue-50 border-blue-200 text-blue-800",destructive:"bg-red-50 border-red-200 text-red-800"}[r]," ").concat(s),...a,children:t})},k=e=>{let{className:s="",children:r,...t}=e;return(0,l.jsx)("div",{className:"text-sm leading-relaxed ".concat(s),...t,children:r})};var C=r(53850),L=r(1812),E=r(23015),S=r(1272),A=r(93225),W=r(53081);let D=e=>{let{message:s}=e;return s?(0,l.jsxs)(v,{className:"border-green-200 bg-green-50",children:[(0,l.jsx)(p.Z,{className:"h-4 w-4 text-green-600"}),(0,l.jsx)(k,{className:"text-green-800",children:s})]}):null},P=e=>{let{workspaceName:s,config:r,enabledClouds:t=[]}=e;if(!r)return null;let a="default"===s,n=0===Object.keys(r).length;if(a&&n)return(0,l.jsx)("div",{className:"text-sm text-gray-500 mb-3 italic p-3 bg-sky-50 rounded border border-sky-200",children:"Workspace 'default' can use all accessible infrastructure."});let c=[],i=[],o=[],d=new Set(t.map(e=>e.toLowerCase()));Object.entries(r).forEach(e=>{let[s,r]=e;if("private"===s||"allowed_users"===s)return;let t=A.Z2[s.toLowerCase()]||s.toUpperCase(),a=null==t?void 0:t.toLowerCase(),n=d.has(a)||Array.from(d).some(e=>e.startsWith(a+"/")),u=()=>"kubernetes"===s.toLowerCase()?Array.from(d).filter(e=>e.startsWith(a+"/")).map(e=>e.split("/")[1]):[];if((null==r?void 0:r.disabled)===!0)i.push(t);else if(r&&Object.keys(r).length>0){let e="";if("gcp"===s.toLowerCase()&&r.project_id)e=" (Project ID: ".concat(r.project_id,")");else if("aws"===s.toLowerCase()&&r.region)e=" (Region: ".concat(r.region,")");else if("kubernetes"===s.toLowerCase()){let s=u();s.length>0&&(e=" (Contexts: ".concat(s.join(", "),")"))}n?c.push((0,l.jsxs)("span",{className:"block",children:[t,e," is enabled."]},"".concat(s,"-enabled"))):o.push((0,l.jsxs)("span",{className:"block text-amber-700",children:[t,e," is configured but not currently available."]},"".concat(s,"-configured-not-enabled")))}else if(n){let e="";if("kubernetes"===s.toLowerCase()){let s=u();s.length>0&&(e=" (Contexts: ".concat(s.join(", "),")"))}c.push((0,l.jsxs)("span",{className:"block",children:[t,e," is enabled (using default settings)."]},"".concat(s,"-default-enabled")))}else o.push((0,l.jsxs)("span",{className:"block text-amber-700",children:[t," is configured but not currently available."]},"".concat(s,"-default-not-enabled")))});let u=[];if(i.length>0){let e=i.join(" and ");u.push((0,l.jsxs)("span",{className:"block",children:[e," ",1===i.length?"is":"are"," explicitly disabled."]},"disabled-clouds"))}return(u.push(...c),u.push(...o),u.length>0)?(0,l.jsx)("div",{className:"text-sm text-gray-700 mb-3 p-3 bg-sky-50 rounded border border-sky-200",children:u}):!a&&n?(0,l.jsx)("div",{className:"text-sm text-gray-500 mb-3 italic p-3 bg-sky-50 rounded border border-sky-200",children:"This workspace has no specific cloud resource configurations and can use all accessible infrastructure."}):null},R=e=>{let{isPrivate:s}=e;return s?(0,l.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-700 border border-gray-300",children:"Private"}):(0,l.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700 border border-green-300",children:"Public"})},Z=e=>{let{workspaceConfig:s,allUsers:r}=e;if(!s.private)return null;let t=s.allowed_users||[],a=(r||[]).filter(e=>"admin"===e.role).map(e=>e.username),n=[...new Set([...t,...a])];return 0===n.length?(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Allowed Users (0)"}),(0,l.jsx)("div",{className:"text-amber-600 text-xs italic p-2 bg-amber-50 rounded border border-amber-200",children:"No users configured (workspace may be inaccessible)"})]}):(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsxs)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:["Allowed Users (",n.length,")"]}),(0,l.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto border border-gray-200 rounded",children:n.map(e=>{let s=a.includes(e);return(0,l.jsxs)("div",{className:"flex items-center justify-between text-xs p-2 bg-gray-50 hover:bg-gray-100 border-b border-gray-100 last:border-b-0",children:[(0,l.jsx)("span",{className:"font-medium text-gray-700",children:e}),s?(0,l.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,l.jsx)(C.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,l.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,l.jsx)(b.Z,{className:"w-3 h-3 mr-1"}),"User"]})]},e)})})]})};function _(e){let{workspaceName:s,isNewWorkspace:r=!1}=e,o=(0,a.useRouter)(),[u,p]=(0,t.useState)({}),[b,v]=(0,t.useState)({}),[k,A]=(0,t.useState)(""),[_,z]=(0,t.useState)(!0),[M,O]=(0,t.useState)(!1),[U,Y]=(0,t.useState)(!1),[J,T]=(0,t.useState)(null),[I,F]=(0,t.useState)(null),[X,B]=(0,t.useState)(null),[G,H]=(0,t.useState)([]),[V,q]=(0,t.useState)({showDialog:!1,deleting:!1,error:null}),[K,Q]=(0,t.useState)({totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:[]}),[$,ee]=(0,t.useState)(!1),es=(0,t.useCallback)(async()=>{z(!0),T(null);try{let e;let[r,l]=await Promise.all([(0,n.fX)(),(0,W.R)()]),t=r[s]||{};p(t),v(t),H(l||[]),e=0===Object.keys(t).length?"".concat(s,":\n # Empty workspace configuration - uses all accessible infrastructure\n"):S.ZP.dump({[s]:t},{indent:2,lineWidth:-1,noRefs:!0,skipInvalid:!0,flowLevel:-1}),A(e)}catch(e){console.error("Error fetching workspace config:",e),T(e)}finally{z(!1)}},[s]),er=(0,t.useCallback)(async()=>{if(!r){ee(!0);try{let[e,r,l]=await Promise.all([(0,c.getClusters)(),(0,i.getManagedJobs)({allUsers:!0}),(0,n.yz)(s,!0)]),t=e.filter(e=>(e.workspace||"default")===s),a=t.filter(e=>"RUNNING"===e.status||"LAUNCHING"===e.status),o={};e.forEach(e=>{o[e.cluster]=e.workspace||"default"});let d=r.jobs||[],u=new Set(E.statusGroups.active),x=0;d.forEach(e=>{let r=e.cluster_name||e.resources&&e.resources.cluster_name;r&&o[r]===s&&u.has(e.status)&&x++}),Q({totalClusterCount:t.length,runningClusterCount:a.length,managedJobsCount:x,clouds:Array.isArray(l)?l:[]})}catch(e){console.error("Failed to fetch workspace stats:",e)}finally{ee(!1)}}},[s,r]);(0,t.useEffect)(()=>{r?(z(!1),A("".concat(s,":\n # New workspace configuration\n # Leave empty to use all accessible infrastructure\n"))):(es(),er())},[s,r,es,er]),(0,t.useEffect)(()=>{Y(JSON.stringify(u)!==JSON.stringify(b))},[u,b]);let el=e=>{A(e),B(null);try{let r=S.ZP.load(e)||{},l=Object.keys(r);if(0===l.length)p({});else if(1===l.length){let e=l[0];if(e!==s){B('Workspace name cannot be changed. Expected "'.concat(s,'" but found "').concat(e,'".'));return}let t=r[s]||{};p(t)}else B("Configuration must contain only one workspace. Found: ".concat(l.join(", ")))}catch(e){B("Invalid YAML: ".concat(e.message))}},et=async()=>{O(!0),T(null),F(null);try{if(X)throw Error("Please fix YAML errors before saving");let e=S.ZP.load(k)||{},l=Object.keys(e);if(l.length>0&&l[0]!==s)throw Error('Workspace name cannot be changed. Expected "'.concat(s,'".'));r?(await (0,n.MB)(s,u),F("Workspace created successfully!"),setTimeout(()=>{o.push("/workspaces/".concat(s))},1500)):(await (0,n.eA)(s,u),F("Workspace updated successfully!"),v(u),er())}catch(e){console.error("Error saving workspace:",e),T(e)}finally{O(!1)}},ea=async()=>{q(e=>({...e,deleting:!0,error:null}));try{await (0,n.zl)(s),F("Workspace deleted successfully!"),setTimeout(()=>{o.push("/workspaces")},1500)}catch(e){console.error("Error deleting workspace:",e),q(s=>({...s,deleting:!1,error:e}))}},en=()=>{q({showDialog:!1,deleting:!1,error:null})},ec=async()=>{await Promise.all([es(),er()])};if(!o.isReady)return(0,l.jsx)("div",{children:"Loading..."});let ei=r?"Create New Workspace | SkyPilot Dashboard":"Workspace: ".concat(s," | SkyPilot Dashboard");return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(x(),{children:(0,l.jsx)("title",{children:ei})}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,l.jsxs)("div",{className:"text-base flex items-center",children:[(0,l.jsx)(d(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,l.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,l.jsx)(d(),{href:r?"/workspace/new":"/workspaces/".concat(s),className:"text-sky-blue hover:underline",children:r?"New Workspace":s}),U&&(0,l.jsx)("span",{className:"ml-3 px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded",children:"Unsaved changes"})]}),(0,l.jsxs)("div",{className:"text-sm flex items-center",children:[(_||M||$)&&(0,l.jsxs)("div",{className:"flex items-center mr-4",children:[(0,l.jsx)(g.Z,{size:15,className:"mt-0"}),(0,l.jsx)("span",{className:"ml-2 text-gray-500",children:M?"Saving...":"Loading..."})]}),(0,l.jsxs)("div",{className:"flex items-center space-x-4",children:[!r&&(0,l.jsxs)("button",{onClick:ec,disabled:_||M||$,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,l.jsx)(j.Z,{className:"w-4 h-4 mr-1.5"}),"Refresh"]}),!r&&"default"!==s&&(0,l.jsxs)("button",{onClick:()=>q({...V,showDialog:!0}),disabled:V.deleting||M,className:"text-red-600 hover:text-red-700 font-medium inline-flex items-center",children:[(0,l.jsx)(y.Z,{className:"w-4 h-4 mr-1.5"}),"Delete"]})]})]})]}),_?(0,l.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,l.jsx)(g.Z,{size:24,className:"mr-2"}),(0,l.jsx)("span",{className:"text-gray-500",children:"Loading workspace configuration..."})]}):(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsx)(L.X,{error:J,title:"Error",onDismiss:()=>T(null)}),(0,l.jsx)(D,{message:I}),(0,l.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[!r&&(0,l.jsx)("div",{className:"lg:col-span-1",children:(0,l.jsxs)(m.Zb,{className:"h-full",children:[(0,l.jsx)(m.Ol,{children:(0,l.jsx)(m.ll,{className:"text-base font-normal",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"font-semibold",children:"Workspace:"})," ",s]}),(0,l.jsx)(R,{isPrivate:!0===b.private})]})})}),(0,l.jsxs)(m.aY,{className:"text-sm pb-2 flex-1",children:[(0,l.jsxs)("div",{className:"py-2 flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,l.jsx)(C.QT,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,l.jsx)("span",{children:"Clusters (Running / Total)"})]}),(0,l.jsx)("span",{className:"font-normal text-gray-800",children:$?"...":"".concat(K.runningClusterCount," / ").concat(K.totalClusterCount)})]}),(0,l.jsxs)("div",{className:"py-2 flex items-center justify-between border-t border-gray-100",children:[(0,l.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,l.jsx)(C.Vp,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,l.jsx)("span",{children:"Managed Jobs"})]}),(0,l.jsx)("span",{className:"font-normal text-gray-800",children:$?"...":K.managedJobsCount})]})]}),(0,l.jsxs)("div",{className:"px-6 pb-6 text-sm pt-3",children:[(0,l.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Enabled Infra"}),(0,l.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:$?(0,l.jsx)("span",{className:"text-gray-500",children:"Loading..."}):K.clouds.length>0?K.clouds.map(e=>(0,l.jsxs)("div",{className:"flex items-center text-gray-700",children:[(0,l.jsx)(C.Ye,{className:"w-3.5 h-3.5 mr-1.5 text-green-500"}),(0,l.jsx)("span",{children:e})]},e)):(0,l.jsx)("span",{className:"text-gray-500 italic",children:"No enabled infrastructure"})}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)(P,{workspaceName:s,config:b,enabledClouds:K.clouds})}),(0,l.jsx)(Z,{workspaceConfig:b,allUsers:G})]})]})}),(0,l.jsx)("div",{className:r?"lg:col-span-3":"lg:col-span-2",children:(0,l.jsxs)(m.Zb,{className:"h-full flex flex-col",children:[(0,l.jsx)(m.Ol,{children:(0,l.jsx)(m.ll,{className:"text-base font-normal",children:r?"New Workspace YAML":"Edit Workspace YAML"})}),(0,l.jsx)(m.aY,{className:"flex-1 flex flex-col",children:(0,l.jsxs)("div",{className:"space-y-4 flex-1 flex flex-col",children:[X&&(0,l.jsx)(L.X,{error:X,onDismiss:()=>B(null)}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,l.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Configure infra-specific settings for this workspace. Leave empty to use all accessible infrastructure. Refer to"," ",(0,l.jsx)("a",{href:"https://docs.skypilot.co/en/latest/admin/workspaces.html#configuration",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600",children:"SkyPilot Docs"})," ","for more details."]}),(0,l.jsxs)("div",{className:"mb-4",children:[(0,l.jsx)("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Example configuration:"}),(0,l.jsx)("div",{className:"p-3 bg-gray-50 border rounded-lg",children:(0,l.jsx)("pre",{className:"text-xs font-mono text-gray-600 whitespace-pre-wrap",children:"".concat(s||"my-workspace",":\n private: true\n allowed_users:\n - user1@mydomain.com\n - user2@mydomain.com\n gcp:\n project_id: xxx\n disabled: false\n kubernetes:\n allowed_contexts:\n - context-1")})})]}),(0,l.jsx)(f.g,{value:k,onChange:e=>el(e.target.value),className:"font-mono text-sm flex-1 resize-none",style:{minHeight:"350px"},spellCheck:!1,placeholder:"# Enter workspace configuration in YAML format"}),(0,l.jsx)("div",{className:"flex justify-end space-x-3 pt-3 border-gray-200",children:(0,l.jsxs)(h.z,{onClick:et,disabled:M||X||_,className:"inline-flex items-center bg-sky-600 hover:bg-sky-700 text-white",children:[(0,l.jsx)(N.Z,{className:"w-4 h-4 mr-1.5"}),M?"Applying...":"Apply"]})})]})]})})]})})]})]}),(0,l.jsx)(w.Vq,{open:V.showDialog,onOpenChange:en,children:(0,l.jsxs)(w.cZ,{className:"sm:max-w-md",children:[(0,l.jsxs)(w.fK,{className:"",children:[(0,l.jsx)(w.$N,{children:"Delete Workspace"}),(0,l.jsxs)(w.Be,{children:['Are you sure you want to delete workspace "',s,'"? This action cannot be undone.']})]}),V.error&&(0,l.jsx)(L.X,{error:V.error,title:"Deletion Failed",onDismiss:()=>q(e=>({...e,error:null}))}),(0,l.jsxs)(w.cN,{className:"",children:[(0,l.jsx)(h.z,{variant:"outline",onClick:en,disabled:V.deleting,children:"Cancel"}),(0,l.jsx)(h.z,{variant:"destructive",onClick:ea,disabled:V.deleting,children:V.deleting?"Deleting...":"Delete"})]})]})})]})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2350],{32350:function(n,r,u){u.d(r,{cn:function(){return c}});var e=u(90512),t=u(98388);function c(){for(var n=arguments.length,r=Array(n),u=0;u<n;u++)r[u]=arguments[u];return(0,t.m6)((0,e.W)(r))}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3015],{23015:function(e,s,t){t.r(s),t.d(s,{ClusterJobs:function(){return K},ManagedJobs:function(){return B},ManagedJobsTable:function(){return T},Status2Actions:function(){return q},filterJobsByName:function(){return U},filterJobsByPool:function(){return O},filterJobsByUser:function(){return W},filterJobsByWorkspace:function(){return J},statusGroups:function(){return z}});var r=t(85893),a=t(67294),l=t(11163),n=t(41664),i=t.n(n),c=t(55739),o=t(30803),d=t(37673),h=t(68764),u=t(36989),x=t(51214),m=t(68969),p=t(6378);class j{_generateFilterKey(e){let{allUsers:s=!0,nameMatch:t,userMatch:r,workspaceMatch:a,poolMatch:l}=e;return["allUsers:".concat(s),t?"name:".concat(t):"",r?"user:".concat(r):"",a?"workspace:".concat(a):"",l?"pool:".concat(l):""].filter(Boolean).join("|")||"default"}_getCacheStatus(e){let s=this.fullDataCache.get(e),t=Date.now();if(!s)return{isCached:!1,isFresh:!1,age:0,maxAge:12e4,hasData:!1};let r=t-s.timestamp;return{isCached:!0,isFresh:r<12e4,age:r,maxAge:12e4,hasData:s.jobs&&Array.isArray(s.jobs),data:s}}async getPaginatedJobs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{page:s=1,limit:t=10,...r}=e,a=this._generateFilterKey(r);try{let e=this._getCacheStatus(a);if(e.isCached&&e.hasData){let l=e.data,n=(s-1)*t,i=l.jobs.slice(n,n+t);if(!this.prefetching.has(a)&&(!e.isFresh||e.age>e.maxAge/2)){let e=this._loadFullDataset(r,a).catch(()=>{}).finally(()=>this.prefetching.delete(a));this.prefetching.set(a,e)}return{jobs:i,total:l.total,controllerStopped:l.controllerStopped,fromCache:!0,cacheStatus:e.isFresh?"local_cache_hit":"local_cache_stale_hit"}}let l=await p.default.get(m.getManagedJobs,[{...r,page:s,limit:t}]),n=(null==l?void 0:l.jobs)||[],i="number"==typeof(null==l?void 0:l.total)?l.total:n.length,c=!!(null==l?void 0:l.controllerStopped);if(!this.prefetching.has(a)){let e=this._loadFullDataset(r,a).catch(e=>{console.warn("Background prefetch of full jobs failed:",e)}).finally(()=>{this.prefetching.delete(a)});this.prefetching.set(a,e)}return{jobs:n,total:i,controllerStopped:c,fromCache:!1,cacheStatus:"server_page_fetch"}}catch(e){return console.error("Error in getPaginatedJobs:",e),{jobs:[],total:0,controllerStopped:!1,fromCache:!1,cacheStatus:"error"}}}async _loadFullDataset(e,s){let t=await p.default.get(m.getManagedJobs,[e]);if(t.controllerStopped||!t.jobs)return t;let r={jobs:t.jobs,total:t.jobs.length,controllerStopped:!1,timestamp:Date.now()};return this.fullDataCache.set(s,r),r}isDataLoading(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=this._generateFilterKey(e);return this.isLoading.has(s)||this.prefetching.has(s)}isDataCached(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=this._generateFilterKey(e),t=this._getCacheStatus(s);return t.isCached&&t.isFresh&&t.hasData}getCacheStatus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=this._generateFilterKey(e);return this._getCacheStatus(s)}invalidateCache(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(e){let s=this._generateFilterKey(e);this.fullDataCache.delete(s),this.isLoading.delete(s),this.prefetching.delete(s)}else this.fullDataCache.clear(),this.isLoading.clear(),this.prefetching.clear();p.default.invalidateFunction(m.getManagedJobs)}getCacheStats(){let e={cachedFilters:Array.from(this.fullDataCache.keys()),loadingFilters:Array.from(this.isLoading.keys()),prefetchingFilters:Array.from(this.prefetching.keys()),cacheSize:this.fullDataCache.size,loadingCount:this.isLoading.size,prefetchingCount:this.prefetching.size};for(let[s,t]of(e.detailedStatus={},this.fullDataCache.entries())){let r=this._getCacheStatus(s);e.detailedStatus[s]={age:r.age,isFresh:r.isFresh,hasData:r.hasData,jobCount:t.jobs?t.jobs.length:0}}return e}constructor(){this.fullDataCache=new Map,this.isLoading=new Map,this.prefetching=new Map}}let f=new j;var g=t(23266),b=t(17324),v=t(53081),w=t(13626),y=t(23293),N=t(6521),k=t(53610),C=t(92128),S=t(94545),L=t(99307),_=t(20546),E=t(23001),R=t(88950);let D=(e,s)=>{let t={...e.query},r=[],a=[],l=[];s.map((e,s)=>{var t;r.push(null!==(t=e.property.toLowerCase())&&void 0!==t?t:""),a.push(e.operator),l.push(e.value)}),t.property=r,t.operator=a,t.value=l,e.replace({pathname:e.pathname,query:t},void 0,{shallow:!0})},M=(e,s)=>{let t={...e.query},r=t.property,a=t.operator,l=t.value;if(void 0===r)return[];let n=[],i=Array.isArray(r)?r.length:1;if(1===i)n.push({property:s.get(r),operator:a,value:l});else for(let e=0;e<i;e++)n.push({property:s.get(r[e]),operator:a[e],value:l[e]});return n},F=e=>{var s,t;let{propertyList:l=[],valueList:n,setFilters:i,updateURLParams:c,placeholder:o="Filter items"}=e,d=(0,a.useRef)(null),h=(0,a.useRef)(null),[u,x]=(0,a.useState)(!1),[m,p]=(0,a.useState)(""),[j,f]=(0,a.useState)((null===(s=l[0])||void 0===s?void 0:s.value)||"status"),[g,b]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=e=>{h.current&&!h.current.contains(e.target)&&d.current&&!d.current.contains(e.target)&&x(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,a.useEffect)(()=>{let e=[];n&&"object"==typeof n&&(e=n[j]||[]),""!==m.trim()&&(e=e.filter(e=>e&&e.toString().toLowerCase().includes(m.toLowerCase()))),b(e)},[j,n,m]);let v=e=>{let s=l.find(s=>s.value===e);return s?s.label:e},w=e=>{i(s=>{let t=[...s,{property:v(j),operator:":",value:e}];return c(t),t}),x(!1),p(""),d.current.focus()};return(0,r.jsxs)("div",{className:"flex flex-row border border-gray-300 rounded-md overflow-visible",children:[(0,r.jsx)("div",{className:"border-r border-gray-300 flex-shrink-0",children:(0,r.jsxs)(R.Ph,{onValueChange:f,value:j,children:[(0,r.jsx)(R.i4,{"aria-label":"Filter Property",className:"focus:ring-0 focus:ring-offset-0 border-none rounded-l-md rounded-r-none w-20 sm:w-24 md:w-32 h-8 text-xs sm:text-sm",children:(0,r.jsx)(R.ki,{placeholder:(null===(t=l[0])||void 0===t?void 0:t.label)||"Status"})}),(0,r.jsx)(R.Bw,{children:l.map((e,s)=>(0,r.jsx)(R.Ql,{value:e.value,children:e.label},"property-item-".concat(s)))})]})}),(0,r.jsxs)("div",{className:"relative flex-1",children:[(0,r.jsx)("input",{type:"text",ref:d,placeholder:o,value:m,onChange:e=>{p(e.target.value),u||x(!0)},onFocus:()=>{x(!0)},onKeyDown:e=>{"Enter"===e.key&&""!==m.trim()?(i(e=>{let s=[...e,{property:v(j),operator:":",value:m}];return c(s),s}),p(""),x(!1)):"Escape"===e.key&&(x(!1),d.current.blur())},className:"h-8 w-full sm:w-96 px-3 pr-8 text-sm border-none rounded-l-none rounded-r-md focus:ring-0 focus:outline-none",autoComplete:"off"}),m&&(0,r.jsx)("button",{onClick:()=>{p(""),x(!1)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear filter",tabIndex:-1,children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),u&&g.length>0&&(0,r.jsx)("div",{ref:h,className:"absolute z-50 mt-1 w-full bg-white border border-gray-200 rounded-md shadow-lg max-h-60 overflow-y-auto",style:{zIndex:9999},children:g.map((e,s)=>(0,r.jsx)("div",{className:"px-3 py-2 cursor-pointer hover:bg-gray-50 text-sm ".concat(s!==g.length-1?"border-b border-gray-100":""),onClick:()=>w(e),children:(0,r.jsx)("span",{className:"text-sm text-gray-700",children:e})},"".concat(e,"-").concat(s)))})]})]})},I=e=>{let{filters:s=[],setFilters:t,updateURLParams:a}=e,l=e=>{t(s=>{let t=s.filter((s,t)=>t!==e);return a(t),t})};return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"flex items-center gap-4 py-2 px-2",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-content gap-2",children:[s.map((e,s)=>(0,r.jsx)(A,{filter:e,onRemove:()=>l(s)},"filteritem-".concat(s))),s.length>0&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("button",{onClick:()=>{a([]),t([])},className:"rounded-full px-4 py-1 text-sm text-gray-700 bg-gray-200 hover:bg-gray-300",children:"Clear filters"})})]})})})},A=e=>{let{filter:s,onRemove:t}=e;return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex items-center text-blue-600 bg-blue-100 px-1 py-1 rounded-full text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 px-2",children:[(0,r.jsx)("span",{children:"".concat(s.property," ")}),(0,r.jsx)("span",{children:"".concat(s.operator," ")}),(0,r.jsx)("span",{children:" ".concat(s.value)})]}),(0,r.jsx)("button",{onClick:()=>t(),className:"p-0.5 ml-1 transform text-gray-400 hover:text-gray-600 bg-blue-500 hover:bg-blue-600 rounded-full flex flex-col items-center",title:"Clear filter",children:(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"white",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:5,d:"M6 18L18 6M6 6l12 12"})})})]})})},z={active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]},P=[{label:"Name",value:"name"},{label:"User",value:"user"},{label:"Workspace",value:"workspace"},{label:"Pool",value:"pool"}];function U(e,s){if(!s||""===s.trim())return e;let t=s.toLowerCase().trim();return e.filter(e=>(e.name||"").toLowerCase().includes(t))}function J(e,s){return s&&"ALL_WORKSPACES"!==s?e.filter(e=>(e.workspace||"default").toLowerCase()===s.toLowerCase()):e}function W(e,s){return s&&"ALL_USERS"!==s?e.filter(e=>(e.user_hash||e.user)===s):e}function O(e,s){if(!s||""===s.trim())return e;let t=s.toLowerCase().trim();return e.filter(e=>(e.pool||"").toLowerCase().includes(t))}let Z=e=>{if(!e)return"-";let s=e instanceof Date?e:new Date(1e3*e);return(0,r.jsx)(u.Zg,{date:s})};function B(){let e=(0,l.useRouter)(),[s,t]=(0,a.useState)(!1),[n,c]=(0,a.useState)(!0),[o,d]=(0,a.useState)(!0),h=a.useRef(null),x=a.useRef(null),[j,g]=(0,a.useState)([]),[w,y]=(0,a.useState)([]),N=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t(!0),!e&&o&&c(!0);try{let[e]=await Promise.all([p.default.get(m.vs,[{}])]);g(e.pools||[])}catch(e){console.error("Error fetching data:",e)}finally{t(!1),!e&&o&&(c(!1),d(!1))}};(0,a.useEffect)(()=>{N()},[]);let k=s=>{D(e,s)},C=a.useCallback(()=>{let s=new Map;s.set("",""),s.set("status","Status"),s.set("name","Name"),s.set("user","User"),s.set("workspace","Workspace"),s.set("pool","Pool"),y(M(e,s))},[e,y]);return(0,a.useEffect)(()=>{e.isReady&&C()},[e.isReady,e.query.tab,C]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[(0,r.jsx)("div",{className:"text-base",children:(0,r.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"})}),(0,r.jsx)("div",{className:"w-full sm:w-auto",children:(0,r.jsx)(F,{propertyList:P,valueList:{},setFilters:y,updateURLParams:k,placeholder:"Filter jobs"})})]}),(0,r.jsx)(I,{filters:w,setFilters:y,updateURLParams:k}),(0,r.jsx)(T,{refreshInterval:u.yc,setLoading:t,refreshDataRef:h,filters:w,onRefresh:()=>{f.invalidateCache(),p.default.invalidate(m.vs,[{}]),p.default.invalidate(b.fX),p.default.invalidate(v.R),N(!0),h.current&&h.current(),x.current&&x.current()},poolsData:j,poolsLoading:n}),(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(V,{refreshInterval:u.yc,setLoading:t,refreshDataRef:x})})]})}function T(e){let{refreshInterval:s,setLoading:t,refreshDataRef:l,filters:n,onRefresh:j,poolsData:b,poolsLoading:v}=e,[N,k]=(0,a.useState)([]),[R,D]=(0,a.useState)(0),[M,F]=(0,a.useState)({key:null,direction:"ascending"}),[I,A]=(0,a.useState)(!1),[P,U]=(0,a.useState)(!0),[J,W]=(0,a.useState)(1),[O,B]=(0,a.useState)(10),[T,K]=(0,a.useState)(null),V=(0,a.useRef)(null),[X,Y]=(0,a.useState)([]),[Q,$]=(0,a.useState)({}),[ee,es]=(0,a.useState)(!1),[et,er]=(0,a.useState)(!1),[ea,el]=(0,a.useState)(!1),[en,ei]=(0,a.useState)("all"),[ec,eo]=(0,a.useState)(!0),[ed,eh]=(0,a.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),eu=(0,E.X)(),ex=async()=>{eh({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller?",onConfirm:async()=>{try{el(!0),A(!0),await (0,m.Ce)("restartcontroller"),await em()}catch(e){console.error("Error restarting controller:",e)}finally{el(!1),A(!1)}}})},em=a.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=!1!==e.includeStatus;A(!0),t(!0);try{let e;let t=e=>{let s=(n||[]).find(s=>(s.property||"").toLowerCase()===e);return s&&s.value?String(s.value):void 0},r={allUsers:!0,nameMatch:t("name"),userMatch:t("user"),workspaceMatch:t("workspace"),poolMatch:t("pool"),page:J,limit:O},a=null;if(f.isDataCached(r),f.isDataLoading(r),s){let[s,t]=await Promise.all([f.getPaginatedJobs(r),p.default.get(g.getClusters)]);e=s,a=t}else e=await f.getPaginatedJobs(r);let{jobs:l=[],total:i=0,controllerStopped:c=!1,cacheStatus:o="unknown"}=e||{},d=!!c,h=!1;if(s&&a){let e=null==a?void 0:a.find(e=>(0,S.Ym)(e.cluster)),s=e?e.status:"NOT_FOUND";"STOPPED"==s&&c&&(d=!0),"LAUNCHING"==s&&(h=!0)}k(l),D(i||0),es(!!d),er(!!h),U(!1)}catch(e){console.error("Error fetching data:",e),k([]),es(!1),U(!1)}finally{A(!1),t(!1)}},[t,n,J,O]);a.useEffect(()=>{l&&(l.current=em)},[l,em]);let ep=a.useRef(em);a.useEffect(()=>{ep.current=em},[em]),a.useEffect(()=>{em({includeStatus:!0})},[]),a.useEffect(()=>{em({includeStatus:!1})},[J]),a.useEffect(()=>{em({includeStatus:!0})},[n,O]),(0,a.useEffect)(()=>{let e=setInterval(()=>{ep.current&&ep.current({includeStatus:!0})},s);return()=>{clearInterval(e)}},[s]),(0,a.useEffect)(()=>{W(1)},[en]),(0,a.useEffect)(()=>{W(1)},[n,O]),(0,a.useEffect)(()=>{Y([]),eo(!0)},[en]);let ej=e=>{let s="ascending";M.key===e&&"ascending"===M.direction&&(s="descending"),F({key:e,direction:s})},ef=e=>M.key===e?"ascending"===M.direction?" ↑":" ↓":"";a.useMemo(()=>{let e=N||[];return{active:e.filter(e=>z.active.includes(e.status)).length,finished:e.filter(e=>z.finished.includes(e.status)).length}},[N]);let eg=e=>X.length>0?X.includes(e):"all"===en||z[en].includes(e),eb=a.useMemo(()=>X.length>0?N.filter(e=>X.includes(e.status)):ec?"all"===en?N:N.filter(e=>z[en].includes(e.status)):[],[N,en,X,ec]),ev=a.useMemo(()=>M.key?[...eb].sort((e,s)=>e[M.key]<s[M.key]?"ascending"===M.direction?-1:1:e[M.key]>s[M.key]?"ascending"===M.direction?1:-1:0):eb,[eb,M]),ew=(J-1)*O,ey=R>0?Math.ceil(R/O):0,eN=R>0?Math.min(ew+ev.length,R):0,ek=e=>{if(X.includes(e)){let s=X.filter(s=>s!==e);0===s.length?(eo(!0),Y([])):(Y(s),eo(!1))}else Y([...X,e]),eo(!1)};return(0,a.useEffect)(()=>{$((N||[]).reduce((e,s)=>(e[s.status]=(e[s.status]||0)+1,e),{}))},[N]),(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 justify-between text-sm mb-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center",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:[!I&&(!N||0===N.length)&&!P&&(0,r.jsx)("span",{className:"text-gray-500 mr-2",children:"No jobs found"}),Object.entries(Q).map(e=>{let[s,t]=e;return(0,r.jsxs)("button",{onClick:()=>ek(s),className:"px-3 py-0.5 rounded-full flex items-center space-x-2 ".concat(eg(s)||X.includes(s)?(0,L.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(eg(s)||X.includes(s)?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:t})]},s)}),N&&N.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:()=>{ei("all"),Y([]),eo(!0)},className:"text-sm font-medium ".concat("all"===en&&ec?"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:()=>{ei("active"),Y([]),eo(!0)},className:"text-sm font-medium ".concat("active"===en&&ec?"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:()=>{ei("finished"),Y([]),eo(!0)},className:"text-sm font-medium ".concat("finished"===en&&ec?"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.jsxs)("div",{className:"flex items-center gap-2",children:[I&&(0,r.jsxs)("div",{className:"flex items-center",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:()=>{j&&j(),l&&l.current&&l.current()},disabled:I,className:"text-sky-blue hover:text-sky-blue-bright flex items-center text-sm",children:[(0,r.jsx)(w.Z,{className:"h-4 w-4 mr-1.5"}),(0,r.jsx)("span",{children:"Refresh"})]})]})]})}),eu&&ee&&0===ev.length&&!I&&!P&&(0,r.jsx)("div",{className:"mb-4 p-4 bg-gray-50 rounded-lg border",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-3",children:[(0,r.jsxs)("p",{className:"text-gray-700 text-center text-sm",children:["Job controller stopped.",(0,r.jsx)("br",{}),"Restart to check status."]}),(0,r.jsx)(o.z,{variant:"outline",size:"sm",onClick:ex,className:"text-sky-blue hover:text-sky-blue-bright",disabled:I||ea,children:ea?(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)(y.Z,{className:"h-4 w-4 mr-2"}),"Restart"]})})]})}),(0,r.jsx)(d.Zb,{children:(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(h.iA,{className:"min-w-full",children:[(0,r.jsx)(h.xD,{children:(0,r.jsxs)(h.SC,{children:[(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("id"),children:["ID",ef("id")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("name"),children:["Name",ef("name")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("user"),children:["User",ef("user")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("workspace"),children:["Workspace",ef("workspace")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("submitted_at"),children:["Submitted",ef("submitted_at")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("job_duration"),children:["Duration",ef("job_duration")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("status"),children:["Status",ef("status")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("resources_str"),children:["Requested",ef("resources_str")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("infra"),children:["Infra",ef("infra")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("cluster"),children:["Resources",ef("cluster")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("recoveries"),children:["Recoveries",ef("recoveries")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ej("pool"),children:["Worker Pool",ef("pool")]}),(0,r.jsx)(h.ss,{children:"Details"}),(0,r.jsx)(h.ss,{children:"Logs"})]})}),(0,r.jsx)(h.RM,{children:I&&P?(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:12,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..."})]})})}):ev.length>0?(0,r.jsx)(r.Fragment,{children:ev.map(e=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(h.SC,{children:[(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.name})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(_.H,{username:e.user,userHash:e.user_hash})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/workspaces",className:"text-gray-700 hover:text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,r.jsx)(h.pj,{children:Z(e.submitted_at)}),(0,r.jsx)(h.pj,{children:(0,u.LU)(e.job_duration)}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(L.OE,{status:e.status})}),(0,r.jsx)(h.pj,{children:e.requested_resources}),(0,r.jsx)(h.pj,{children:e.infra&&"-"!==e.infra?(0,r.jsx)(u.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:" "+(()=>{let s=x.MO.NAME_TRUNCATE_LENGTH,t=e.infra.substring(e.infra.indexOf("(")),r=t.substring(1,t.length-1);if(r.length<=s)return t;let a="".concat(r.substring(0,Math.floor((s-3)/2)),"...").concat(r.substring(r.length-Math.ceil((s-3)/2)));return"(".concat(a,")")})()})]})}):(0,r.jsx)("span",{children:e.infra||"-"})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(u.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)(h.pj,{children:e.recoveries}),(0,r.jsx)(h.pj,{children:(0,r.jsx)("div",{className:v?"blur-sm transition-all duration-300":"",children:v?"-":(0,u.os)(e.pool,e.pool_hash,b)})}),(0,r.jsx)(h.pj,{children:e.details?(0,r.jsx)(G,{text:e.details,rowId:e.id,expandedRowId:T,setExpandedRowId:K}):"-"}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(q,{jobParent:"/jobs",jobId:e.id,managed:!0})})]}),T===e.id&&(0,r.jsx)(H,{text:e.details,colSpan:13,innerRef:V})]},e.id))}):(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:13,className:"text-center py-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[et&&(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..."})]})]}),!ee&&!et&&(0,r.jsx)("p",{className:"text-gray-500",children:"No active jobs"}),!eu&&ee&&(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-3 px-4",children:[(0,r.jsx)("p",{className:"text-gray-700 text-center text-sm sm:text-base max-w-md",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:ex,className:"text-sky-blue hover:text-sky-blue-bright",disabled:I||ea,children:ea?(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)(y.Z,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})})}),(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=>{B(parseInt(e.target.value,10)),W(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.jsx)("div",{children:R>0?"".concat(ew+1," – ").concat(eN," of ").concat(R):"0 – 0 of 0"}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{W(e=>Math.max(e-1,1))},disabled:1===J||!ev||0===ev.length,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:()=>{ey>0&&J<ey&&W(e=>e+1)},disabled:0===ey||J>=ey||!ev||0===ev.length,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)(C.cV,{isOpen:ed.isOpen,onClose:()=>eh({...ed,isOpen:!1}),onConfirm:ed.onConfirm,title:ed.title,message:ed.message,confirmClassName:"bg-blue-600 hover:bg-blue-700 text-white"})]})}function q(e){let{withLabel:s=!1,jobParent:t,jobId:a,managed:n}=e,i=(0,l.useRouter)(),c=(e,s)=>{e.preventDefault(),e.stopPropagation(),i.push({pathname:"".concat(t,"/").concat(a),query:{tab:s}})};return(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsx)(u.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)(N.Z,{className:"w-4 h-4"}),s&&(0,r.jsx)("span",{className:"ml-1.5",children:"Logs"})]})},"logs"),n&&(0,r.jsx)(u.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)(k.Z,{className:"w-4 h-4"}),s&&(0,r.jsx)("span",{className:"ml-2",children:"Controller Logs"})]})},"controllerlogs")]})}function K(e){let{clusterName:s,clusterJobData:t,loading:l,refreshClusterJobsOnly:n,userFilter:x=null,nameFilter:m=null}=e,[p,j]=(0,a.useState)(null),[f,g]=(0,a.useState)({key:null,direction:"ascending"}),[b,v]=(0,a.useState)(1),[y,N]=(0,a.useState)(10),k=(0,a.useRef)(null),[C,S]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=e=>{p&&k.current&&!k.current.contains(e.target)&&j(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[p]);let E=a.useMemo(()=>{let e=t||[];return x&&"ALL_USERS"!==x&&(e=W(e,x)),m&&(e=U(e,m)),e},[t,x,m]);(0,a.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(C)&&S(t)},[t,C]);let R=a.useMemo(()=>f.key?[...E].sort((e,s)=>e[f.key]<s[f.key]?"ascending"===f.direction?-1:1:e[f.key]>s[f.key]?"ascending"===f.direction?1:-1:0):E,[E,f]),D=e=>{let s="ascending";f.key===e&&"ascending"===f.direction&&(s="descending"),g({key:e,direction:s})},M=e=>f.key===e?"ascending"===f.direction?" ↑":" ↓":"",F=Math.ceil(R.length/y),I=(b-1)*y,A=I+y,z=R.slice(I,A);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:n&&(0,r.jsxs)("button",{onClick:n,disabled:l,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center text-sm ml-2",children:[(0,r.jsx)(w.Z,{className:"w-4 h-4 mr-1"}),"Refresh Jobs"]})})]}),(0,r.jsxs)(h.iA,{children:[(0,r.jsx)(h.xD,{children:(0,r.jsxs)(h.SC,{children:[(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>D("id"),children:["ID",M("id")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>D("job"),children:["Name",M("job")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>D("user"),children:["User",M("user")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>D("workspace"),children:["Workspace",M("workspace")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>D("submitted_at"),children:["Submitted",M("submitted_at")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>D("job_duration"),children:["Duration",M("job_duration")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>D("status"),children:["Status",M("status")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>D("resources"),children:["Resources",M("resources")]}),(0,r.jsx)(h.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,r.jsx)(h.RM,{children:l?(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.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..."})]})})}):z.length>0?z.map(e=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(h.SC,{className:p===e.id?"selected-row":"",children:[(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:e.id})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:(0,r.jsx)(G,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:p,setExpandedRowId:j})})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(_.H,{username:e.user,userHash:e.user_hash})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/workspaces",className:"text-gray-700 hover:text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,r.jsx)(h.pj,{children:Z(e.submitted_at)}),(0,r.jsx)(h.pj,{children:(0,u.LU)(e.job_duration)}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(L.OE,{status:e.status})}),(0,r.jsx)(h.pj,{children:e.resources}),(0,r.jsx)(h.pj,{className:"flex content-center items-center",children:(0,r.jsx)(q,{jobParent:"/clusters/".concat(s),jobId:e.id,managed:!1})})]}),p===e.id&&(0,r.jsx)(H,{text:e.job||"Unnamed job",colSpan:9,innerRef:k})]},e.id)):(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:"No jobs found"})})})]})]}),R&&R.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:y,onChange:e=>{N(parseInt(e.target.value,10)),v(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:[I+1," – ",Math.min(A,R.length)," of"," ",R.length]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{v(e=>Math.max(e-1,1))},disabled:1===b,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:()=>{v(e=>Math.min(e+1,F))},disabled:b===F||0===F,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 H(e){let{text:s,colSpan:t,innerRef:a}=e;return(0,r.jsx)(h.SC,{className:"expanded-details",children:(0,r.jsx)(h.pj,{colSpan:t,children:(0,r.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border border-gray-200",ref:a,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 G(e){let{text:s,rowId:t,expandedRowId:l,setExpandedRowId:n}=e,i=s||"",c=i.length>50,o=l===t,d=c?"".concat(i.substring(0,50)):i,h=(0,a.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:h,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),n(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"})]})}function V(e){let{refreshInterval:s,setLoading:t,refreshDataRef:l}=e,[n,o]=(0,a.useState)([]),[x,j]=(0,a.useState)({key:null,direction:"ascending"}),[f,g]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!0),[w,y]=(0,a.useState)(1),[N,k]=(0,a.useState)(10),C=a.useCallback(async()=>{g(!0),t(!0);try{let{pools:e=[]}=await p.default.get(m.vs,[{}])||{};o(e),v(!1)}catch(e){console.error("Error fetching pools data:",e),o([]),v(!1)}finally{g(!1),t(!1)}},[t]);a.useEffect(()=>{l&&(l.current=C)},[l,C]),(0,a.useEffect)(()=>{o([]);let e=!0;C();let t=setInterval(()=>{e&&C()},s);return()=>{e=!1,clearInterval(t)}},[s,C]);let S=e=>{let s="ascending";x.key===e&&"ascending"===x.direction&&(s="descending"),j({key:e,direction:s})},_=e=>x.key===e?"ascending"===x.direction?" ↑":" ↓":"",E=a.useMemo(()=>x.key?[...n].sort((e,s)=>e[x.key]<s[x.key]?"ascending"===x.direction?-1:1:e[x.key]>s[x.key]?"ascending"===x.direction?1:-1:0):n,[n,x]),R=Math.ceil(E.length/N),D=(w-1)*N,M=D+N,F=E.slice(D,M),I=e=>{if(!e||!e.replica_info||0===e.replica_info.length)return"0 (target: 0)";let s=e.replica_info.filter(e=>"READY"===e.status).length,t=e.target_num_replicas||0;return"".concat(s," (target: ").concat(t,")")},A=e=>{let{jobCounts:s}=e;return(0,r.jsx)(u.x9,{jobCounts:s,getStatusStyle:L.Cl})},z=e=>{let{replicaInfo:s}=e;return(0,r.jsx)(u.Kl,{replicaInfo:s})};return(0,r.jsxs)(d.Zb,{children:[(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(h.iA,{className:"min-w-full table-fixed",children:[(0,r.jsx)(h.xD,{children:(0,r.jsxs)(h.SC,{children:[(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap w-32",onClick:()=>S("name"),children:["Pool",_("name")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap w-40",onClick:()=>S("job_counts"),children:["Jobs",_("job_counts")]}),(0,r.jsx)(h.ss,{className:"whitespace-nowrap w-20",children:"Workers"}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap w-36",onClick:()=>S("requested_resources_str"),children:["Worker Details",_("requested_resources_str")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap w-40",onClick:()=>S("requested_resources_str"),children:["Worker Resources",_("requested_resources_str")]})]})}),(0,r.jsx)(h.RM,{children:f&&b?(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:5,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..."})]})})}):F.length>0?F.map(e=>(0,r.jsxs)(h.SC,{children:[(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/jobs/pools/".concat(e.name),className:"text-blue-600 hover:text-blue-800",children:e.name})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(A,{jobCounts:e.jobCounts})}),(0,r.jsx)(h.pj,{children:I(e)}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(z,{replicaInfo:e.replica_info})}),(0,r.jsx)(h.pj,{children:e.requested_resources_str||"-"})]},e.name)):(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:"No pools found"})})})]})}),F.length>0&&R>1&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-200",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("span",{className:"text-sm text-gray-700",children:"Rows per page:"}),(0,r.jsxs)("select",{value:N,onChange:e=>{k(parseInt(e.target.value,10)),y(1)},className:"border border-gray-300 rounded px-2 py-1 text-sm",children:[(0,r.jsx)("option",{value:5,children:"5"}),(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:25,children:"25"}),(0,r.jsx)("option",{value:50,children:"50"})]})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsxs)("span",{className:"text-sm text-gray-700",children:[D+1,"-",Math.min(M,E.length)," of"," ",E.length]}),(0,r.jsx)("button",{onClick:()=>{y(e=>Math.max(e-1,1))},disabled:1===w,className:"px-2 py-1 text-sm border border-gray-300 rounded disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50",children:"Previous"}),(0,r.jsx)("button",{onClick:()=>{y(e=>Math.min(e+1,R))},disabled:w===R,className:"px-2 py-1 text-sm border border-gray-300 rounded disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50",children:"Next"})]})]})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3785],{42557:function(e,s,r){r.d(s,{I:function(){return n}});var t=r(85893),a=r(67294),l=r(32350);let n=a.forwardRef((e,s)=>{let{className:r,type:a,...n}=e;return(0,t.jsx)("input",{type:a,className:(0,l.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:s,...n})});n.displayName="Input"},29749:function(e,s,r){r.d(s,{_:function(){return d}});var t=r(85893),a=r(67294),l=r(75320),n=a.forwardRef((e,s)=>(0,t.jsx)(l.WV.label,{...e,ref:s,onMouseDown:s=>{s.target.closest("button, input, select, textarea")||(e.onMouseDown?.(s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));n.displayName="Label";var i=r(12003),o=r(32350);let c=(0,i.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)(n,{ref:s,className:(0,o.cn)(c(),r),...a})});d.displayName=n.displayName},33785:function(e,s,r){r.r(s),r.d(s,{NewWorkspace:function(){return b}});var t=r(85893),a=r(67294),l=r(11163),n=r(41664),i=r.n(n),o=r(5152),c=r.n(o),d=r(17324),u=r(30803),m=r(42557),f=r(29749),p=r(37673);let x=c()(()=>Promise.all([r.e(616),r.e(5739),r.e(7411),r.e(1272),r.e(6633),r.e(6989),r.e(3850),r.e(8969),r.e(6135),r.e(4509),r.e(7557),r.e(3015),r.e(1141)]).then(r.bind(r,11141)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[11141]},ssr:!1});function b(){(0,l.useRouter)();let[e,s]=(0,a.useState)(""),[r,n]=(0,a.useState)(!1),[o,c]=(0,a.useState)({}),[b,h]=(0,a.useState)(!0);(0,a.useEffect)(()=>{v()},[]);let v=async()=>{try{let e=await (0,d.fX)();c(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{h(!1)}},k=()=>{e.trim()&&!y&&n(!0)},y=e.trim()&&o.hasOwnProperty(e.trim()),w=e.trim()&&!y;return r?(0,t.jsx)(x,{workspaceName:e,isNewWorkspace:!0}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("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)(i(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,t.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,t.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,t.jsxs)(p.Zb,{className:"max-w-md",children:[(0,t.jsx)(p.Ol,{children:(0,t.jsx)(p.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,t.jsxs)(p.aY,{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(f._,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,t.jsx)(m.I,{id:"workspace-name",value:e,onChange:e=>s(e.target.value),placeholder:"Enter workspace name",autoFocus:!0,onKeyPress:e=>{"Enter"===e.key&&w&&k()}}),y?(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,t.jsx)(i(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,t.jsx)(u.z,{onClick:k,disabled:!w||b,className:"w-full bg-sky-600 hover:bg-sky-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:b?"Loading...":"Next: Configure Workspace"})]})]})]})}},12003:function(e,s,r){r.d(s,{j:function(){return n}});var t=r(90512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=t.W,n=(e,s)=>r=>{var t;if((null==s?void 0:s.variants)==null)return l(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:n,defaultVariants:i}=s,o=Object.keys(n).map(e=>{let s=null==r?void 0:r[e],t=null==i?void 0:i[e];if(null===s)return null;let l=a(s)||a(t);return n[e][l]}),c=r&&Object.entries(r).reduce((e,s)=>{let[r,t]=s;return void 0===t||(e[r]=t),e},{});return l(e,o,null==s?void 0:null===(t=s.compoundVariants)||void 0===t?void 0:t.reduce((e,s)=>{let{class:r,className:t,...a}=s;return Object.entries(a).every(e=>{let[s,r]=e;return Array.isArray(r)?r.includes({...i,...c}[s]):({...i,...c})[s]===r})?[...e,r,t]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);
|