skypilot-nightly 1.0.0.dev20250423__py3-none-any.whl → 1.0.0.dev20250425__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.
Files changed (54) hide show
  1. sky/__init__.py +2 -2
  2. sky/adaptors/aws.py +57 -4
  3. sky/adaptors/common.py +2 -1
  4. sky/adaptors/kubernetes.py +14 -9
  5. sky/backends/backend_utils.py +5 -1
  6. sky/cli.py +10 -1
  7. sky/client/cli.py +10 -1
  8. sky/client/sdk.py +14 -1
  9. sky/clouds/aws.py +3 -4
  10. sky/clouds/gcp.py +5 -2
  11. sky/clouds/service_catalog/data_fetchers/fetch_aws.py +3 -2
  12. sky/dag.py +5 -2
  13. sky/dashboard/out/404.html +1 -1
  14. sky/dashboard/out/_next/static/chunks/236-2db3ee3fba33dd9e.js +6 -0
  15. sky/dashboard/out/_next/static/chunks/37-0a572fe0dbb89c4d.js +6 -0
  16. sky/dashboard/out/_next/static/chunks/845-9e60713e0c441abc.js +1 -0
  17. sky/dashboard/out/_next/static/chunks/979-7bf73a4c7cea0f5c.js +1 -0
  18. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-6ac338bc2239cb45.js +1 -0
  19. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-f383db7389368ea7.js +1 -0
  20. sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-1c519e1afc523dc9.js +1 -0
  21. sky/dashboard/out/_next/static/css/c6933bbb2ce7f4dd.css +3 -0
  22. sky/dashboard/out/_next/static/hTtTTWqHyRidxVG24ujEi/_buildManifest.js +1 -0
  23. sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
  24. sky/dashboard/out/clusters/[cluster].html +1 -1
  25. sky/dashboard/out/clusters.html +1 -1
  26. sky/dashboard/out/favicon.ico +0 -0
  27. sky/dashboard/out/index.html +1 -1
  28. sky/dashboard/out/jobs/[job].html +1 -1
  29. sky/dashboard/out/jobs.html +1 -1
  30. sky/data/mounting_utils.py +11 -4
  31. sky/data/storage.py +4 -4
  32. sky/execution.py +1 -1
  33. sky/provision/aws/config.py +30 -11
  34. sky/provision/aws/instance.py +22 -10
  35. sky/server/server.py +13 -10
  36. sky/skylet/constants.py +12 -0
  37. sky/task.py +12 -4
  38. {skypilot_nightly-1.0.0.dev20250423.dist-info → skypilot_nightly-1.0.0.dev20250425.dist-info}/METADATA +1 -1
  39. {skypilot_nightly-1.0.0.dev20250423.dist-info → skypilot_nightly-1.0.0.dev20250425.dist-info}/RECORD +45 -45
  40. {skypilot_nightly-1.0.0.dev20250423.dist-info → skypilot_nightly-1.0.0.dev20250425.dist-info}/WHEEL +1 -1
  41. sky/dashboard/out/_next/static/68UjuSjrx8JvfzxUuf1-w/_buildManifest.js +0 -1
  42. sky/dashboard/out/_next/static/chunks/236-d437cf66e68a6f64.js +0 -6
  43. sky/dashboard/out/_next/static/chunks/37-72fdc8f71d6e4784.js +0 -6
  44. sky/dashboard/out/_next/static/chunks/845-2ea1cc63ba1f4067.js +0 -1
  45. sky/dashboard/out/_next/static/chunks/979-7cd0778078b9cfad.js +0 -1
  46. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-b09f7fbf6d5d74f6.js +0 -1
  47. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-b57ec043f09c5813.js +0 -1
  48. sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-ef2e0e91a9222cac.js +0 -1
  49. sky/dashboard/out/_next/static/css/f3538cd90cfca88c.css +0 -3
  50. /sky/dashboard/out/_next/static/chunks/pages/{_app-3001e84c61acddfb.js → _app-e6b013bc3f77ad60.js} +0 -0
  51. /sky/dashboard/out/_next/static/{68UjuSjrx8JvfzxUuf1-w → hTtTTWqHyRidxVG24ujEi}/_ssgManifest.js +0 -0
  52. {skypilot_nightly-1.0.0.dev20250423.dist-info → skypilot_nightly-1.0.0.dev20250425.dist-info}/entry_points.txt +0 -0
  53. {skypilot_nightly-1.0.0.dev20250423.dist-info → skypilot_nightly-1.0.0.dev20250425.dist-info}/licenses/LICENSE +0 -0
  54. {skypilot_nightly-1.0.0.dev20250423.dist-info → skypilot_nightly-1.0.0.dev20250425.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 = '2f7f792534e7dccc3c12134123ea4f56db74eacd'
8
+ _SKYPILOT_COMMIT_SHA = 'e9e27ba0f154b7c292791c4e1290a5a55338e20b'
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.dev20250423'
38
+ __version__ = '1.0.0.dev20250425'
39
39
  __root_dir__ = os.path.dirname(os.path.abspath(__file__))
40
40
 
41
41
 
sky/adaptors/aws.py CHANGED
@@ -31,12 +31,22 @@ This is informed by the following boto3 docs:
31
31
  import logging
32
32
  import threading
33
33
  import time
34
- from typing import Any, Callable
34
+ import typing
35
+ from typing import Callable, Literal, Optional, TypeVar
35
36
 
36
37
  from sky.adaptors import common
37
38
  from sky.utils import annotations
38
39
  from sky.utils import common_utils
39
40
 
41
+ if typing.TYPE_CHECKING:
42
+ import boto3
43
+ _ = boto3 # Supress pylint use before assignment error
44
+ import mypy_boto3_ec2
45
+ import mypy_boto3_iam
46
+ import mypy_boto3_s3
47
+ import mypy_boto3_service_quotas
48
+ import mypy_boto3_sts
49
+
40
50
  _IMPORT_ERROR_MESSAGE = ('Failed to import dependencies for AWS. '
41
51
  'Try pip install "skypilot[aws]"')
42
52
  boto3 = common.LazyImport('boto3', import_error_message=_IMPORT_ERROR_MESSAGE)
@@ -44,6 +54,8 @@ botocore = common.LazyImport('botocore',
44
54
  import_error_message=_IMPORT_ERROR_MESSAGE)
45
55
  _LAZY_MODULES = (boto3, botocore)
46
56
 
57
+ T = TypeVar('T')
58
+
47
59
  logger = logging.getLogger(__name__)
48
60
  _session_creation_lock = threading.RLock()
49
61
 
@@ -73,8 +85,8 @@ def _assert_kwargs_builtin_type(kwargs):
73
85
  f'kwargs should not contain none built-in types: {kwargs}')
74
86
 
75
87
 
76
- def _create_aws_object(creation_fn_or_cls: Callable[[], Any],
77
- object_name: str) -> Any:
88
+ def _create_aws_object(creation_fn_or_cls: Callable[[], T],
89
+ object_name: str) -> T:
78
90
  """Create an AWS object.
79
91
 
80
92
  Args:
@@ -123,6 +135,25 @@ def session(check_credentials: bool = True):
123
135
  return s
124
136
 
125
137
 
138
+ # New typing overloads can be added as needed.
139
+ @typing.overload
140
+ def resource(service_name: Literal['ec2'],
141
+ **kwargs) -> 'mypy_boto3_ec2.ServiceResource':
142
+ ...
143
+
144
+
145
+ @typing.overload
146
+ def resource(service_name: Literal['s3'],
147
+ **kwargs) -> 'mypy_boto3_s3.ServiceResource':
148
+ ...
149
+
150
+
151
+ @typing.overload
152
+ def resource(service_name: Literal['iam'],
153
+ **kwargs) -> 'mypy_boto3_iam.ServiceResource':
154
+ ...
155
+
156
+
126
157
  # Avoid caching the resource/client objects. If we are using the assumed role,
127
158
  # the credentials will be automatically rotated, but the cached resource/client
128
159
  # object will only refresh the credentials with a fixed 15 minutes interval,
@@ -142,7 +173,7 @@ def resource(service_name: str, **kwargs):
142
173
  """
143
174
  _assert_kwargs_builtin_type(kwargs)
144
175
 
145
- max_attempts = kwargs.pop('max_attempts', None)
176
+ max_attempts: Optional[int] = kwargs.pop('max_attempts', None)
146
177
  if max_attempts is not None:
147
178
  config = botocore_config().Config(
148
179
  retries={'max_attempts': max_attempts})
@@ -158,6 +189,28 @@ def resource(service_name: str, **kwargs):
158
189
  service_name, **kwargs), 'resource')
159
190
 
160
191
 
192
+ # New typing overloads can be added as needed.
193
+ @typing.overload
194
+ def client(service_name: Literal['s3'], **kwargs) -> 'mypy_boto3_s3.Client':
195
+ pass
196
+
197
+
198
+ @typing.overload
199
+ def client(service_name: Literal['ec2'], **kwargs) -> 'mypy_boto3_ec2.Client':
200
+ pass
201
+
202
+
203
+ @typing.overload
204
+ def client(service_name: Literal['sts'], **kwargs) -> 'mypy_boto3_sts.Client':
205
+ pass
206
+
207
+
208
+ @typing.overload
209
+ def client(service_name: Literal['service-quotas'],
210
+ **kwargs) -> 'mypy_boto3_service_quotas.Client':
211
+ pass
212
+
213
+
161
214
  def client(service_name: str, **kwargs):
162
215
  """Create an AWS client of a certain service.
163
216
 
sky/adaptors/common.py CHANGED
@@ -2,10 +2,11 @@
2
2
  import functools
3
3
  import importlib
4
4
  import threading
5
+ import types
5
6
  from typing import Any, Callable, Optional, Tuple
6
7
 
7
8
 
8
- class LazyImport:
9
+ class LazyImport(types.ModuleType):
9
10
  """Lazy importer for modules.
10
11
 
11
12
  This is mainly used in two cases:
@@ -70,21 +70,26 @@ def _load_config(context: Optional[str] = None):
70
70
  kubernetes.config.load_kube_config(context=context)
71
71
  except kubernetes.config.config_exception.ConfigException as e:
72
72
  suffix = common_utils.format_exception(e, use_bracket=True)
73
+ context_name = '(current-context)' if context is None else context
73
74
  # Check if exception was due to no current-context
74
75
  if 'Expected key current-context' in str(e):
75
- err_str = (
76
- f'Failed to load Kubernetes configuration for {context!r}. '
77
- 'Kubeconfig does not contain any valid context(s).'
78
- f'\n{suffix}\n'
79
- ' If you were running a local Kubernetes '
80
- 'cluster, run `sky local up` to start the cluster.')
76
+ err_str = ('Failed to load Kubernetes configuration for '
77
+ f'{context_name!r}. '
78
+ 'Kubeconfig does not contain any valid context(s).'
79
+ f'\n{suffix}\n'
80
+ ' If you were running a local Kubernetes '
81
+ 'cluster, run `sky local up` to start the cluster.')
81
82
  else:
82
83
  kubeconfig_path = os.environ.get('KUBECONFIG', '~/.kube/config')
83
84
  err_str = (
84
- f'Failed to load Kubernetes configuration for {context!r}. '
85
- 'Please check if your kubeconfig file exists at '
86
- f'{kubeconfig_path} and is valid.\n{suffix}')
85
+ f'Failed to load Kubernetes configuration for '
86
+ f'{context_name!r}. Please check if your kubeconfig file '
87
+ f'exists at {kubeconfig_path} and is valid.\n{suffix}')
87
88
  err_str += '\nTo disable Kubernetes for SkyPilot: run `sky check`.'
89
+ if context is None: # kubernetes defaults to current-context.
90
+ err_str += (
91
+ '\nHint: Kubernetes attempted to query the current-context '
92
+ 'set in kubeconfig. Check if the current-context is valid.')
88
93
  with ux_utils.print_exception_no_traceback():
89
94
  raise ValueError(err_str) from None
90
95
 
@@ -702,6 +702,8 @@ def write_cluster_config(
702
702
  # to use, which is likely to already have a conda environment activated.
703
703
  conda_auto_activate = ('true' if to_provision.extract_docker_image() is None
704
704
  else 'false')
705
+ is_custom_docker = ('true' if to_provision.extract_docker_image()
706
+ is not None else 'false')
705
707
 
706
708
  # Use a tmp file path to avoid incomplete YAML file being re-used in the
707
709
  # future.
@@ -741,7 +743,9 @@ def write_cluster_config(
741
743
  # syntax.
742
744
  'conda_installation_commands':
743
745
  constants.CONDA_INSTALLATION_COMMANDS.replace(
744
- '{conda_auto_activate}', conda_auto_activate),
746
+ '{conda_auto_activate}',
747
+ conda_auto_activate).replace('{is_custom_docker}',
748
+ is_custom_docker),
745
749
  'ray_skypilot_installation_commands':
746
750
  (constants.RAY_SKYPILOT_INSTALLATION_COMMANDS.replace(
747
751
  '{sky_wheel_hash}',
sky/cli.py CHANGED
@@ -4271,6 +4271,14 @@ def jobs_dashboard():
4271
4271
  managed_jobs.dashboard()
4272
4272
 
4273
4273
 
4274
+ @cli.command(cls=_DocumentedCodeCommand)
4275
+ @config_option(expose_value=False)
4276
+ @usage_lib.entrypoint
4277
+ def dashboard() -> None:
4278
+ """Starts the dashboard for skypilot."""
4279
+ sdk.dashboard()
4280
+
4281
+
4274
4282
  @cli.group(cls=_NaturalOrderGroup)
4275
4283
  def serve():
4276
4284
  """SkyServe CLI (multi-region, multi-cloud serving)."""
@@ -5902,7 +5910,8 @@ def api_info():
5902
5910
  api_server_info = sdk.api_info()
5903
5911
  user_name = os.getenv(constants.USER_ENV_VAR, getpass.getuser())
5904
5912
  user_hash = common_utils.get_user_hash()
5905
- click.echo(f'Using SkyPilot API server: {url}\n'
5913
+ dashboard_url = f'{url}/dashboard'
5914
+ click.echo(f'Using SkyPilot API server: {url} Dashboard: {dashboard_url}\n'
5906
5915
  f'{ux_utils.INDENT_SYMBOL}Status: {api_server_info["status"]}, '
5907
5916
  f'commit: {api_server_info["commit"]}, '
5908
5917
  f'version: {api_server_info["version"]}\n'
sky/client/cli.py CHANGED
@@ -4271,6 +4271,14 @@ def jobs_dashboard():
4271
4271
  managed_jobs.dashboard()
4272
4272
 
4273
4273
 
4274
+ @cli.command(cls=_DocumentedCodeCommand)
4275
+ @config_option(expose_value=False)
4276
+ @usage_lib.entrypoint
4277
+ def dashboard() -> None:
4278
+ """Starts the dashboard for skypilot."""
4279
+ sdk.dashboard()
4280
+
4281
+
4274
4282
  @cli.group(cls=_NaturalOrderGroup)
4275
4283
  def serve():
4276
4284
  """SkyServe CLI (multi-region, multi-cloud serving)."""
@@ -5902,7 +5910,8 @@ def api_info():
5902
5910
  api_server_info = sdk.api_info()
5903
5911
  user_name = os.getenv(constants.USER_ENV_VAR, getpass.getuser())
5904
5912
  user_hash = common_utils.get_user_hash()
5905
- click.echo(f'Using SkyPilot API server: {url}\n'
5913
+ dashboard_url = f'{url}/dashboard'
5914
+ click.echo(f'Using SkyPilot API server: {url} Dashboard: {dashboard_url}\n'
5906
5915
  f'{ux_utils.INDENT_SYMBOL}Status: {api_server_info["status"]}, '
5907
5916
  f'commit: {api_server_info["commit"]}, '
5908
5917
  f'version: {api_server_info["version"]}\n'
sky/client/sdk.py CHANGED
@@ -18,6 +18,7 @@ import pathlib
18
18
  import subprocess
19
19
  import typing
20
20
  from typing import Any, Dict, List, Optional, Tuple, Union
21
+ import webbrowser
21
22
 
22
23
  import click
23
24
  import colorama
@@ -294,6 +295,17 @@ def validate(
294
295
  response.json().get('detail'))
295
296
 
296
297
 
298
+ @usage_lib.entrypoint
299
+ @server_common.check_server_healthy_or_start
300
+ @annotations.client_api
301
+ def dashboard() -> None:
302
+ """Starts the dashboard for SkyPilot."""
303
+ api_server_url = server_common.get_server_url()
304
+ url = f'{api_server_url}/dashboard'
305
+ logger.info(f'Opening dashboard in browser: {url}')
306
+ webbrowser.open(url)
307
+
308
+
297
309
  @usage_lib.entrypoint
298
310
  @server_common.check_server_healthy_or_start
299
311
  @annotations.client_api
@@ -1713,8 +1725,9 @@ def api_start(
1713
1725
  if foreground:
1714
1726
  # Explain why current process exited
1715
1727
  logger.info('API server is already running:')
1728
+ dashboard_msg = f'Dashboard: {server_common.get_server_url(host)}/dashboard'
1716
1729
  logger.info(f'{ux_utils.INDENT_SYMBOL}SkyPilot API server: '
1717
- f'{server_common.get_server_url(host)}\n'
1730
+ f'{server_common.get_server_url(host)} {dashboard_msg}\n'
1718
1731
  f'{ux_utils.INDENT_LAST_SYMBOL}'
1719
1732
  f'View API server logs at: {constants.API_SERVER_LOGS}')
1720
1733
 
sky/clouds/aws.py CHANGED
@@ -312,13 +312,12 @@ class AWS(clouds.Cloud):
312
312
  'Example: ami-0729d913a335efca7')
313
313
  try:
314
314
  client = aws.client('ec2', region_name=region)
315
- image_info = client.describe_images(ImageIds=[image_id])
316
- image_info = image_info.get('Images', [])
315
+ image_info = client.describe_images(ImageIds=[image_id]).get(
316
+ 'Images', [])
317
317
  if not image_info:
318
318
  with ux_utils.print_exception_no_traceback():
319
319
  raise ValueError(image_not_found_message)
320
- image_info = image_info[0]
321
- image_size = image_info['BlockDeviceMappings'][0]['Ebs'][
320
+ image_size = image_info[0]['BlockDeviceMappings'][0]['Ebs'][
322
321
  'VolumeSize']
323
322
  except (aws.botocore_exceptions().NoCredentialsError,
324
323
  aws.botocore_exceptions().ProfileNotFound):
sky/clouds/gcp.py CHANGED
@@ -174,7 +174,10 @@ class GCP(clouds.Cloud):
174
174
  # Install the Google Cloud SDK:
175
175
  f'{_INDENT_PREFIX} $ pip install google-api-python-client\n'
176
176
  f'{_INDENT_PREFIX} $ conda install -c conda-forge '
177
- 'google-cloud-sdk -y')
177
+ 'google-cloud-sdk -y\n'
178
+ f'{_INDENT_PREFIX} If gcloud was recently installed with wget, API server'
179
+ ' may need to be restarted with following commands:\n'
180
+ f'{_INDENT_PREFIX} $ sky api stop; sky api start')
178
181
 
179
182
  _CREDENTIAL_HINT = (
180
183
  'Run the following commands:\n'
@@ -776,7 +779,7 @@ class GCP(clouds.Cloud):
776
779
  raise FileNotFoundError(file)
777
780
  except FileNotFoundError as e:
778
781
  return False, (
779
- f'Credentails are not set. '
782
+ f'Credentials are not set. '
780
783
  f'{cls._CREDENTIAL_HINT}\n'
781
784
  f'{cls._INDENT_PREFIX}Details: '
782
785
  f'{common_utils.format_exception(e, use_bracket=True)}')
@@ -13,7 +13,7 @@ import sys
13
13
  import textwrap
14
14
  import traceback
15
15
  import typing
16
- from typing import Dict, List, Optional, Set, Tuple, Union
16
+ from typing import List, Optional, Set, Tuple, Union
17
17
 
18
18
  import numpy as np
19
19
 
@@ -24,6 +24,7 @@ from sky.utils import log_utils
24
24
  from sky.utils import ux_utils
25
25
 
26
26
  if typing.TYPE_CHECKING:
27
+ from mypy_boto3_ec2 import type_defs as ec2_type_defs
27
28
  import pandas as pd
28
29
  else:
29
30
  pd = adaptors_common.LazyImport('pandas')
@@ -192,7 +193,7 @@ def _get_spot_pricing_table(region: str) -> 'pd.DataFrame':
192
193
  paginator = client.get_paginator('describe_spot_price_history')
193
194
  response_iterator = paginator.paginate(ProductDescriptions=['Linux/UNIX'],
194
195
  StartTime=datetime.datetime.utcnow())
195
- ret: List[Dict[str, str]] = []
196
+ ret: List['ec2_type_defs.SpotPriceTypeDef'] = []
196
197
  for response in response_iterator:
197
198
  # response['SpotPriceHistory'] is a list of dicts, each dict is like:
198
199
  # {
sky/dag.py CHANGED
@@ -76,9 +76,12 @@ class Dag:
76
76
 
77
77
  return out_degree_condition and in_degree_condition
78
78
 
79
- def validate(self, workdir_only: bool = False):
79
+ def validate(self,
80
+ skip_file_mounts: bool = False,
81
+ skip_workdir: bool = False):
80
82
  for task in self.tasks:
81
- task.validate(workdir_only=workdir_only)
83
+ task.validate(skip_file_mounts=skip_file_mounts,
84
+ skip_workdir=skip_workdir)
82
85
 
83
86
 
84
87
  class _DagContext(threading.local):
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>404: This page could not be found</title><meta name="next-head-count" content="3"/><link rel="preload" href="/dashboard/_next/static/css/f3538cd90cfca88c.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/f3538cd90cfca88c.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-830f59b8404e96b8.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-3001e84c61acddfb.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-1be831200e60c5c0.js" defer=""></script><script src="/dashboard/_next/static/68UjuSjrx8JvfzxUuf1-w/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/68UjuSjrx8JvfzxUuf1-w/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"68UjuSjrx8JvfzxUuf1-w","assetPrefix":"/dashboard","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>404: This page could not be found</title><meta name="next-head-count" content="3"/><link rel="preload" href="/dashboard/_next/static/css/c6933bbb2ce7f4dd.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/c6933bbb2ce7f4dd.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-830f59b8404e96b8.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-e6b013bc3f77ad60.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-1be831200e60c5c0.js" defer=""></script><script src="/dashboard/_next/static/hTtTTWqHyRidxVG24ujEi/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/hTtTTWqHyRidxVG24ujEi/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"hTtTTWqHyRidxVG24ujEi","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([[236],{8236:function(e,s,t){t.d(s,{L4:function(){return E},Nk:function(){return C}});var n=t(5893),r=t(7294),a=t(1163),l=t(1664),i=t.n(l),c=t(8799),o=t(803),d=t(7673),h=t(8764),u=t(7469),x=t(8969),m=t(3266),j=t(9470),p=t(3626),f=t(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 g=(0,f.Z)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),b=(0,f.Z)("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]),N=(0,f.Z)("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);var y=t(1266),w=t(4545),v=t(9307),k=t(3001);function C(){let[e,s]=(0,r.useState)(!1),t=r.useRef(null),[a,l]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),d=(0,k.X)();return(0,n.jsxs)(j.A,{highlighted:"jobs",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,n.jsx)("div",{className:"text-base",children:(0,n.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"})}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[e&&(0,n.jsxs)("div",{className:"flex items-center mr-2",children:[(0,n.jsx)(c.Z,{size:15,className:"mt-0"}),(0,n.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,n.jsxs)(o.z,{variant:"ghost",size:"sm",onClick:()=>{t.current&&t.current()},disabled:e,className:"text-sky-blue hover:text-sky-blue-bright",title:"Refresh",children:[(0,n.jsx)(p.Z,{className:"h-4 w-4 mr-1.5"}),!d&&(0,n.jsx)("span",{children:"Refresh"})]})]})]}),(0,n.jsx)(S,{refreshInterval:2e4,setLoading:s,refreshDataRef:t}),(0,n.jsx)(y.cV,{isOpen:a.isOpen,onClose:()=>l({...a,isOpen:!1}),onConfirm:a.onConfirm,title:a.title,message:a.message})]})}function S(e){let{refreshInterval:s,setLoading:t,refreshDataRef:a}=e,[l,j]=(0,r.useState)([]),[p,f]=(0,r.useState)({key:null,direction:"ascending"}),[b,N]=(0,r.useState)(!1),[k,C]=(0,r.useState)(!0),[S,E]=(0,r.useState)(1),[M,O]=(0,r.useState)(10),[D,I]=(0,r.useState)(null),z=(0,r.useRef)(null),[J,P]=(0,r.useState)([]),[T,A]=(0,r.useState)({}),[F,U]=(0,r.useState)(!1),[V,q]=(0,r.useState)(!1),[Z,W]=(0,r.useState)(!1),[G,B]=(0,r.useState)("active"),[H,K]=(0,r.useState)(!0),[X,Y]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),Q=async()=>{Y({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller? This will temporarily interrupt job management.",onConfirm:async()=>{try{W(!0),N(!0),await (0,x.Ce)("restartcontroller",null,null,!0),await $()}catch(e){console.error("Error restarting controller:",e)}finally{W(!1),N(!1)}}})},$=r.useCallback(async()=>{N(!0),t(!0);try{let[e,s]=await Promise.all([(0,x.Vp)(),(0,m.zd)()]),{jobs:t,controllerStopped:n}=e,r=s.find(e=>(0,w.Ym)(e.cluster)),a=r?r.status:"NOT_FOUND",l=!1;"STOPPED"==a&&n&&(l=!0),"LAUNCHING"==a?q(!0):q(!1),j(t),U(l)}catch(e){console.error("Error fetching data:",e),j([])}finally{N(!1),t(!1),C(!1)}},[t]);r.useEffect(()=>{a&&(a.current=$)},[a,$]),(0,r.useEffect)(()=>{j([]);let e=!0;$();let t=setInterval(()=>{e&&$()},s);return()=>{e=!1,clearInterval(t)}},[s,$]),(0,r.useEffect)(()=>{E(1)},[G,l.length]),(0,r.useEffect)(()=>{P([]),K(!0)},[G]);let ee=e=>{let s="ascending";p.key===e&&"ascending"===p.direction&&(s="descending"),f({key:e,direction:s})},es=e=>p.key===e?"ascending"===p.direction?" ↑":" ↓":"",et=r.useMemo(()=>({active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]}),[]);r.useMemo(()=>({active:l.filter(e=>et.active.includes(e.status)).length,finished:l.filter(e=>et.finished.includes(e.status)).length}),[l,et]);let en=e=>J.length>0?J.includes(e):et[G].includes(e),er=r.useMemo(()=>J.length>0?l.filter(e=>J.includes(e.status)):H?l.filter(e=>et[G].includes(e.status)):[],[l,G,J,H,et]),ea=r.useMemo(()=>p.key?[...er].sort((e,s)=>e[p.key]<s[p.key]?"ascending"===p.direction?-1:1:e[p.key]>s[p.key]?"ascending"===p.direction?1:-1:0):er,[er,p]),el=Math.ceil(ea.length/M),ei=(S-1)*M,ec=ei+M,eo=ea.slice(ei,ec),ed=e=>{if(J.includes(e)){let s=J.filter(s=>s!==e);0===s.length?(K(!0),P([])):(P(s),K(!1))}else P([...J,e]),K(!1)};return(0,r.useEffect)(()=>{A(l.reduce((e,s)=>(e[s.status]=(e[s.status]||0)+1,e),{}))},[l]),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("div",{className:"flex flex-col space-y-1 mb-1",children:(0,n.jsxs)("div",{className:"flex flex-wrap items-center text-sm mb-1",children:[(0,n.jsx)("span",{className:"mr-2 text-sm font-medium",children:"Statuses:"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[!b&&0===l.length&&!k&&(0,n.jsx)("span",{className:"text-gray-500 mr-2",children:"No jobs found"}),Object.entries(T).map(e=>{let[s,t]=e;return(0,n.jsxs)("button",{onClick:()=>ed(s),className:"px-3 py-1 rounded-full flex items-center space-x-2 ".concat(en(s)||J.includes(s)?(0,v.Cl)(s):"bg-gray-50 text-gray-600 hover:bg-gray-100"),children:[(0,n.jsx)("span",{children:s}),(0,n.jsx)("span",{className:"text-xs ".concat(en(s)||J.includes(s)?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:t})]},s)}),l.length>0&&(0,n.jsxs)("div",{className:"flex items-center ml-2 gap-2",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"("}),(0,n.jsx)("button",{onClick:()=>{B("active"),P([]),K(!0)},className:"text-sm font-medium ".concat("active"===G&&H?"text-green-700 underline":"text-gray-600 hover:text-green-700 hover:underline"),children:"show all active jobs"}),(0,n.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,n.jsx)("button",{onClick:()=>{B("finished"),P([]),K(!0)},className:"text-sm font-medium ".concat("finished"===G&&H?"text-blue-700 underline":"text-gray-600 hover:text-blue-700 hover:underline"),children:"show all finished jobs"}),(0,n.jsx)("span",{className:"text-gray-500",children:")"})]})]})]})}),(0,n.jsx)(d.Zb,{children:(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ee("id"),children:["ID",es("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ee("name"),children:["Name",es("name")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ee("user"),children:["User",es("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ee("submitted_at"),children:["Submitted",es("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ee("job_duration"),children:["Duration",es("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ee("status"),children:["Status",es("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ee("resources"),children:["Resources",es("resources")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ee("cluster"),children:["Cluster",es("cluster")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ee("region"),children:["Region",es("region")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ee("recoveries"),children:["Recoveries",es("recoveries")]}),(0,n.jsx)(h.ss,{children:"Details"}),(0,n.jsx)(h.ss,{children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:b&&k?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:12,className:"text-center py-6 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(c.Z,{size:20,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading..."})]})})}):eo.length>0?(0,n.jsx)(n.Fragment,{children:eo.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.name})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,u.GV)(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,u.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(v.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.resources}),(0,n.jsx)(h.pj,{children:e.cluster}),(0,n.jsx)(h.pj,{children:e.region}),(0,n.jsx)(h.pj,{children:e.recoveries}),(0,n.jsx)(h.pj,{children:e.details?(0,n.jsx)(R,{text:e.details,rowId:e.id,expandedRowId:D,setExpandedRowId:I}):"-"}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(_,{jobParent:"/jobs",jobId:e.id,managed:!0})})]}),D===e.id&&(0,n.jsx)(L,{text:e.details,colSpan:12,innerRef:z})]},e.id))}):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:12,className:"text-center py-6",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[V&&(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("p",{className:"text-gray-700",children:"The managed job controller is launching. Please wait for it to be ready."}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(c.Z,{size:12,className:"mr-2"}),(0,n.jsx)("span",{className:"text-gray-500",children:"Launching..."})]})]}),!F&&!V&&(0,n.jsx)("p",{className:"text-gray-500",children:"No active jobs"}),F&&(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("p",{className:"text-gray-700",children:"The managed job controller has been stopped. Please restart it to check the latest job status."}),(0,n.jsx)(o.z,{variant:"outline",size:"sm",onClick:Q,className:"text-sky-blue hover:text-sky-blue-bright",disabled:b||Z,children:Z?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(g,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})}),ea.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:M,onChange:e=>{O(parseInt(e.target.value,10)),E(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:30,children:"30"}),(0,n.jsx)("option",{value:50,children:"50"}),(0,n.jsx)("option",{value:100,children:"100"}),(0,n.jsx)("option",{value:200,children:"200"})]}),(0,n.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,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[ei+1," – ",Math.min(ec,ea.length)," of"," ",ea.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{E(e=>Math.max(e-1,1))},disabled:1===S,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{E(e=>Math.min(e+1,el))},disabled:S===el||0===el,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})}),(0,n.jsx)(y.cV,{isOpen:X.isOpen,onClose:()=>Y({...X,isOpen:!1}),onConfirm:X.onConfirm,title:X.title,message:X.message})]})}function _(e){let{withLabel:s=!1,jobParent:t,jobId:r,managed:l}=e,i=(0,a.useRouter)(),c=(e,s)=>{e.preventDefault(),e.stopPropagation(),i.push({pathname:"".concat(t,"/").concat(r),query:{tab:s}})};return(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsx)(u.WH,{content:"View Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,n.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,n.jsx)(b,{className:"w-4 h-4"}),s&&(0,n.jsx)("span",{className:"ml-1.5",children:"Logs"})]})},"logs"),l&&(0,n.jsx)(u.WH,{content:"View Controller Logs",className:"capitalize text-sm text-muted-foreground",children:(0,n.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,n.jsx)(N,{className:"w-4 h-4"}),s&&(0,n.jsx)("span",{className:"ml-2",children:"Controller Logs"})]})},"controllerlogs")]})}function E(e){let{clusterName:s,clusterJobData:t,loading:a}=e,[l,x]=(0,r.useState)(null),[m,j]=(0,r.useState)({key:null,direction:"ascending"}),[p,f]=(0,r.useState)(1),[g,b]=(0,r.useState)(10),N=(0,r.useRef)(null),[y,w]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=e=>{l&&N.current&&!N.current.contains(e.target)&&x(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[l]);let k=r.useMemo(()=>t||[],[t]);(0,r.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(y)&&w(t)},[t,y]);let C=r.useMemo(()=>m.key?[...k].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):k,[k,m]),S=e=>{let s="ascending";m.key===e&&"ascending"===m.direction&&(s="descending"),j({key:e,direction:s})},E=e=>m.key===e?"ascending"===m.direction?" ↑":" ↓":"",M=Math.ceil(C.length/g),O=(p-1)*g,D=O+g,I=C.slice(O,D);return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)(d.Zb,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold",children:"Cluster Jobs"}),a&&(0,n.jsxs)("div",{className:"flex items-center mr-2",children:[(0,n.jsx)(c.Z,{size:15,className:"mt-0"}),(0,n.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]})]}),(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("id"),children:["ID",E("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("job"),children:["Name",E("job")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("user"),children:["User",E("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("submitted_at"),children:["Submitted",E("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("job_duration"),children:["Duration",E("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("status"),children:["Status",E("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>S("resources"),children:["Resources",E("resources")]}),(0,n.jsx)(h.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:I.length>0?I.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{className:l===e.id?"selected-row":"",children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:e.id})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:(0,n.jsx)(R,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:l,setExpandedRowId:x})})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,u.GV)(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,u.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(v.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.resources}),(0,n.jsx)(h.pj,{className:"flex content-center items-center",children:(0,n.jsx)(_,{jobParent:"/clusters/".concat(s),jobId:e.id,managed:!1})})]}),l===e.id&&(0,n.jsx)(L,{text:e.job||"Unnamed job",colSpan:8,innerRef:N})]},e.id)):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:"No jobs found"})})})]})]}),C.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:g,onChange:e=>{b(parseInt(e.target.value,10)),f(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:5,children:"5"}),(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:20,children:"20"}),(0,n.jsx)("option",{value:50,children:"50"})]}),(0,n.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,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[O+1," – ",Math.min(D,C.length)," of"," ",C.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{f(e=>Math.max(e-1,1))},disabled:1===p,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{f(e=>Math.min(e+1,M))},disabled:p===M||0===M,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function L(e){let{text:s,colSpan:t,innerRef:r}=e;return(0,n.jsx)(h.SC,{className:"expanded-details",children:(0,n.jsx)(h.pj,{colSpan:t,children:(0,n.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border border-gray-200",ref:r,children:(0,n.jsx)("div",{className:"flex justify-between items-start",children:(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Full Details"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-gray-700",style:{whiteSpace:"pre-wrap"},children:s})]})})})})})}function R(e){let{text:s,rowId:t,expandedRowId:a,setExpandedRowId:l}=e,i=s.length>50,c=a===t,o=i?"".concat(s.substring(0,50)):s,d=(0,r.useRef)(null);return(0,n.jsxs)("div",{className:"truncated-details relative max-w-full flex items-center",children:[(0,n.jsx)("span",{className:"truncate",children:o}),i&&(0,n.jsx)("button",{ref:d,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(c?null:t)},className:"text-blue-600 hover:text-blue-800 font-medium ml-1 flex-shrink-0","data-button-type":"show-more-less",children:c?"... show less":"... show more"})]})}},8969:function(e,s,t){t.d(s,{Ce:function(){return o},NJ:function(){return c},Pr:function(){return i},Vp:function(){return l}});var n=t(7294),r=t(5821),a=t(3225);async function l(){let{allUsers:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let s=(await fetch("".concat(a.f4,"/jobs/queue"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({all_users:e})})).headers.get("x-request-id"),t=await fetch("".concat(a.f4,"/api/get?request_id=").concat(s));if(500===t.status){try{let e=await t.json();if(e.detail&&e.detail.error)try{let s=JSON.parse(e.detail.error);if(s.type&&s.type===a.IV)return{jobs:[],controllerStopped:!0}}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{jobs:[],controllerStopped:!1}}let n=await t.json();return{jobs:(n.return_value?JSON.parse(n.return_value):[]).map(e=>{let s=[];e.submitted_at&&s.push({time:new Date(1e3*e.submitted_at),event:"Job submitted."}),e.start_at&&s.push({time:new Date(1e3*e.start_at),event:"Job started."}),e.end_at&&("CANCELLING"==e.status||"CANCELLED"==e.status?s.push({time:new Date(1e3*e.end_at),event:"Job cancelled."}):s.push({time:new Date(1e3*e.end_at),event:"Job completed."})),e.last_recovered_at&&e.last_recovered_at!=e.start_at&&s.push({time:new Date(1e3*e.last_recovered_at),event:"Job recovered."});let t=(e.end_at?e.end_at:Date.now()/1e3)-e.submitted_at;return{id:e.job_id,task:e.task_name,name:e.job_name,job_duration:e.job_duration,total_duration:t,status:e.status,resources:e.resources,cluster:e.cluster_resources,region:e.region,recoveries:e.recovery_count,details:e.failure_reason,user:e.user_name,submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,events:s}}),controllerStopped:!1}}catch(e){return console.error("Error fetching managed job data:",e),{jobs:[],controllerStopped:!1}}}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,[s,t]=(0,n.useState)(null),[r,a]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{(async function(){try{a(!0);let e=await l({allUsers:!0});t(e)}catch(e){console.error("Error fetching managed job data:",e)}finally{a(!1)}})()},[e]),{jobData:s,loading:r}}async function c(e){let{jobId:s,controller:t=!1,signal:n,onNewLog:l}=e,i=new Promise(e=>{setTimeout(()=>{e({timeout:!0})},1e4)}),c=(async()=>{try{let e=(await fetch("".concat(a.f4,"/jobs/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({controller:t,follow:!1,job_id:s}),...n?{signal:n}:{}})).body.getReader();try{for(;;){let{done:s,value:t}=await e.read();if(s)break;let n=new TextDecoder().decode(t);l(n)}}finally{e.cancel()}return{timeout:!1}}catch(e){if("AbortError"===e.name)return{timeout:!1};throw e}})();if((await Promise.race([c,i])).timeout){(0,r.C)("Log request for job ".concat(s," timed out after ").concat(1e4,"ms"),"error");return}}async function o(e,s,t){let n="",l="",i="",c={};if("restartcontroller"===e)n="Restarting",l="restarted",i="jobs/queue",c={all_users:!0,refresh:!0},s="controller";else throw Error("Invalid action: ".concat(e));(0,r.C)("".concat(n," job ").concat(s,"..."),"info");try{try{let e=(await fetch("".concat(a.f4,"/").concat(i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})).headers.get("x-request-id"),o=await fetch("".concat(a.f4,"/api/get?request_id=").concat(e));if(200===o.status)(0,r.C)("Job ".concat(s," ").concat(l," successfully."),"success");else if(500===o.status)try{let e=await o.json();if(e.detail&&e.detail.error)try{let l=JSON.parse(e.detail.error);l.type&&l.type===a.B8?(0,r.C)("".concat(n," job ").concat(s," is not supported!"),"error",1e4):l.type&&l.type===a.h1?(0,r.C)("Cluster ".concat(t," does not exist."),"error"):l.type&&l.type===a.IV?(0,r.C)("Cluster ".concat(t," is not up."),"error"):(0,r.C)("".concat(n," job ").concat(s," failed: ").concat(l.type),"error")}catch(t){(0,r.C)("".concat(n," job ").concat(s," failed: ").concat(e.detail.error),"error")}else(0,r.C)("".concat(n," job ").concat(s," failed with no details."),"error")}catch(e){(0,r.C)("".concat(n," job ").concat(s," failed with parse error."),"error")}else(0,r.C)("".concat(n," job ").concat(s," failed with status ").concat(o.status,"."),"error")}catch(e){console.error("Fetch error:",e),(0,r.C)("Network error ".concat(n," job ").concat(s,": ").concat(e.message),"error")}}catch(e){console.error("Error in handleStop:",e),(0,r.C)("Critical error ".concat(n," job ").concat(s,": ").concat(e.message),"error")}}}}]);
@@ -0,0 +1,6 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[37],{9037:function(e,s,t){t.d(s,{Cc:function(){return v},GV:function(){return z}});var n=t(5893),l=t(7294),r=t(8799),a=t(7469),c=t(1664),i=t.n(c),o=t(803),d=t(7673),h=t(8764),x=t(3266),u=t(4545),j=t(3626),m=t(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 p=(0,m.Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),g=(0,m.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"}]]);var k=t(9470),f=t(1266),w=t(9307),N=t(3001);function v(){let[e,s]=(0,l.useState)(!1),t=l.useRef(null),[a,c]=(0,l.useState)(!1),[d,h]=(0,l.useState)(!1),[x,u]=(0,l.useState)(null),m=(0,N.X)();return(0,n.jsxs)(k.A,{highlighted:"clusters",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,n.jsx)("div",{className:"text-base",children:(0,n.jsx)(i(),{href:"/clusters",className:"text-sky-blue hover:underline leading-none",children:"Sky Clusters"})}),(0,n.jsxs)("div",{className:"flex items-center",children:[e&&(0,n.jsxs)("div",{className:"flex items-center mr-2",children:[(0,n.jsx)(r.Z,{size:15,className:"mt-0"}),(0,n.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,n.jsxs)(o.z,{variant:"ghost",onClick:()=>{t.current&&t.current()},disabled:e,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,n.jsx)(j.Z,{className:"h-4 w-4 mr-1.5"}),!m&&(0,n.jsx)("span",{children:"Refresh"})]})]})]}),(0,n.jsx)(y,{refreshInterval:1e4,setLoading:s,refreshDataRef:t,onOpenSSHModal:e=>{u(e),c(!0)},onOpenVSCodeModal:e=>{u(e),h(!0)}}),(0,n.jsx)(f.Oh,{isOpen:a,onClose:()=>c(!1),cluster:x}),(0,n.jsx)(f._R,{isOpen:d,onClose:()=>h(!1),cluster:x})]})}function y(e){let{refreshInterval:s,setLoading:t,refreshDataRef:c,onOpenSSHModal:j,onOpenVSCodeModal:m}=e,[p,g]=(0,l.useState)([]),[k,f]=(0,l.useState)({key:null,direction:"ascending"}),[N,v]=(0,l.useState)(!1),[y,C]=(0,l.useState)(!0),[b,S]=(0,l.useState)(1),[M,O]=(0,l.useState)(10),R=l.useCallback(async()=>{t(!0),v(!0),g(await (0,x.zd)()),t(!1),v(!1),C(!1)},[t]),V=l.useMemo(()=>(0,u.R0)(p,k.key,k.direction),[p,k]);l.useEffect(()=>{c&&(c.current=R)},[c,R]),(0,l.useEffect)(()=>{g([]);let e=!0;R();let t=setInterval(()=>{e&&R()},s);return()=>{e=!1,clearInterval(t)}},[s,R]),(0,l.useEffect)(()=>{S(1)},[p.length]);let L=e=>{let s="ascending";k.key===e&&"ascending"===k.direction&&(s="descending"),f({key:e,direction:s})},_=e=>k.key===e?"ascending"===k.direction?" ↑":" ↓":"",E=Math.ceil(V.length/M),W=(b-1)*M,Z=W+M,H=V.slice(W,Z);return(0,n.jsxs)("div",{children:[(0,n.jsx)(d.Zb,{children:(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("status"),children:["Status",_("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("cluster"),children:["Cluster",_("cluster")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("user"),children:["User",_("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("resources_str"),children:["Resources",_("resources_str")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("region"),children:["Region",_("region")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("time"),children:["Started",_("time")]}),(0,n.jsx)(h.ss,{children:"Actions"})]})}),(0,n.jsx)(h.RM,{children:N&&y?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(r.Z,{size:20,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading..."})]})})}):H.length>0?H.map((e,s)=>(0,n.jsxs)(h.SC,{children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(w.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(e.cluster),className:"text-blue-600",children:e.cluster})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:e.resources_str}),(0,n.jsx)(h.pj,{children:e.region}),(0,n.jsx)(h.pj,{children:(0,a.GV)(e.time)}),(0,n.jsx)(h.pj,{className:"text-left",children:(0,n.jsx)(z,{cluster:e.cluster,status:e.status,onOpenSSHModal:j,onOpenVSCodeModal:m})})]},s)):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:"No active clusters"})})})]})}),p.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:M,onChange:e=>{O(parseInt(e.target.value,10)),S(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:30,children:"30"}),(0,n.jsx)("option",{value:50,children:"50"}),(0,n.jsx)("option",{value:100,children:"100"}),(0,n.jsx)("option",{value:200,children:"200"})]}),(0,n.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,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[W+1," – ",Math.min(Z,p.length)," of"," ",p.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{S(e=>Math.max(e-1,1))},disabled:1===b,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{S(e=>Math.min(e+1,E))},disabled:b===E||0===E,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}let C=(e,s)=>{s&&s(e)},b=(e,s)=>{s?s(e):window.open("ssh://".concat(e))},S=e=>"RUNNING"===e?["connect","VSCode"]:[],M={connect:(0,n.jsx)(p,{className:"w-4 h-4 text-gray-500 inline-block"}),VSCode:(0,n.jsx)(g,{className:"w-4 h-4 text-gray-500 inline-block"})};function z(e){let{withLabel:s=!1,cluster:t,status:l,onOpenSSHModal:r,onOpenVSCodeModal:c}=e,i=S(l),o=(0,N.X)(),d=e=>{switch(e){case"connect":b(t,r);break;case"VSCode":C(t,c);break;default:return}};return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("div",{className:"flex items-center space-x-4",children:Object.entries(M).map(e=>{let t,l,[r,c]=e;switch(r){case"connect":t="Connect",l="Connect with SSH";break;case"VSCode":t="VSCode",l="Open in VS Code"}return(s||(t=""),i.includes(r))?(0,n.jsx)(a.WH,{content:l,className:"capitalize text-sm text-muted-foreground",children:(0,n.jsxs)("button",{onClick:()=>d(r),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[c,!o&&(0,n.jsx)("span",{className:"ml-1.5",children:t})]})},r):(0,n.jsx)(a.WH,{content:l,className:"capitalize text-sm text-muted-foreground",children:(0,n.jsxs)("span",{className:"opacity-30 flex items-center cursor-not-allowed text-sm",title:r,children:[c,!o&&(0,n.jsx)("span",{className:"ml-1.5",children:t})]})},r)})})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[845],{1266:function(e,t,a){a.d(t,{cV:function(){return _},Oh:function(){return v},_R:function(){return w}});var s=a(5893),r=a(7294),n=a(5235),o=a(2350),l=a(3767);let c=n.fC;n.xz;let i=n.h_;n.x8;let d=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.aV,{ref:t,className:(0,o.cn)("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...r})});d.displayName=n.aV.displayName;let u=r.forwardRef((e,t)=>{let{className:a,children:r,...c}=e;return(0,s.jsxs)(i,{children:[(0,s.jsx)(d,{}),(0,s.jsxs)(n.VY,{ref:t,className:(0,o.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...c,children:[r,(0,s.jsxs)(n.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-500",children:[(0,s.jsx)(l.Z,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});u.displayName=n.VY.displayName;let f=e=>{let{className:t,...a}=e;return(0,s.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};f.displayName="DialogHeader";let m=e=>{let{className:t,...a}=e;return(0,s.jsx)("div",{className:(0,o.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};m.displayName="DialogFooter";let x=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.Dx,{ref:t,className:(0,o.cn)("text-lg font-semibold leading-none tracking-tight",a),...r})});x.displayName=n.Dx.displayName;let h=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.dk,{ref:t,className:(0,o.cn)("text-sm text-gray-500",a),...r})});h.displayName=n.dk.displayName;var p=a(803),b=a(7673),g=a(8671),j=a(7469),y=a(3225),N=a(3001);function v(e){let{isOpen:t,onClose:a,cluster:n}=e,[o,l]=r.useState(!1),i=e=>{navigator.clipboard.writeText(e),l(!0),setTimeout(()=>l(!1),2e3)},d=["sky status ".concat(n),"ssh ".concat(n)],m=d.join("\n");return(0,s.jsx)(c,{open:t,onOpenChange:a,children:(0,s.jsxs)(u,{className:"sm:max-w-md",children:[(0,s.jsxs)(f,{children:[(0,s.jsxs)(x,{children:["Connect to: ",(0,s.jsx)("span",{className:"font-light",children:n})]}),(0,s.jsx)(h,{children:"Use these instructions to connect to your cluster via SSH."})]}),(0,s.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-medium mb-2",children:"SSH Command"}),(0,s.jsx)(b.Zb,{className:"p-3 bg-gray-50",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("pre",{className:"text-sm w-full whitespace-pre-wrap",children:d.map((e,t)=>(0,s.jsx)("code",{className:"block",children:e},t))}),(0,s.jsx)(j.WH,{content:o?"Copied!":"Copy command",children:(0,s.jsx)(p.z,{variant:"ghost",size:"icon",onClick:()=>i(m),className:"h-8 w-8 rounded-full",children:(0,s.jsx)(g.Z,{className:"h-4 w-4"})})})]})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-medium mb-2",children:"Additional Information"}),(0,s.jsxs)("p",{className:"text-sm text-secondary-foreground",children:["Make sure to run"," ",(0,s.jsxs)("code",{className:"text-sm",children:["sky status ",n]})," first to have SkyPilot set up the SSH access."]})]})]})]})})}function w(e){let{isOpen:t,onClose:a,cluster:r}=e,n=(0,N.X)();return(0,s.jsx)(c,{open:t,onOpenChange:a,children:(0,s.jsx)(u,{className:"sm:max-w-3xl",children:(0,s.jsxs)(f,{children:[(0,s.jsxs)(x,{children:["Connect to: ",(0,s.jsx)("span",{className:"font-light",children:r})]}),(0,s.jsx)(h,{children:(0,s.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-medium mb-2 my-2",children:"Setup SSH access"}),(0,s.jsx)(b.Zb,{className:"p-3 bg-gray-50",children:(0,s.jsx)("pre",{className:"text-sm",children:(0,s.jsxs)("code",{children:["sky status ",r]})})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-medium",children:"Connect with VSCode/Cursor"}),(0,s.jsx)("div",{className:"relative ".concat(n?"-mt-5":"-mt-10"),style:{paddingBottom:"75%"},children:(0,s.jsxs)("video",{className:"absolute top-0 left-0 w-full h-full rounded-lg",controls:!0,autoPlay:!0,muted:!0,preload:"metadata",children:[(0,s.jsx)("source",{src:"".concat(y.GW,"/videos/cursor-small.mp4"),type:"video/mp4"}),"Your browser does not support the video tag."]})})]})]})})]})})})}function _(e){let{isOpen:t,onClose:a,onConfirm:r,title:n,message:o,confirmText:l="Confirm",confirmVariant:i="destructive"}=e;return(0,s.jsx)(c,{open:t,onOpenChange:a,children:(0,s.jsxs)(u,{className:"sm:max-w-md",children:[(0,s.jsxs)(f,{children:[(0,s.jsx)(x,{children:n}),(0,s.jsx)(h,{children:o})]}),(0,s.jsxs)(m,{className:"flex justify-end gap-2 pt-4",children:[(0,s.jsx)(p.z,{variant:"outline",onClick:a,children:"Cancel"}),(0,s.jsx)(p.z,{variant:i,onClick:()=>{r(),a()},children:l})]})]})})}},803:function(e,t,a){a.d(t,{z:function(){return i}});var s=a(5893),r=a(7294),n=a(8426),o=a(5139),l=a(2350);let c=(0,o.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"}}),i=r.forwardRef((e,t)=>{let{className:a,variant:r,size:o,asChild:i=!1,...d}=e,u=i?n.g7:"button";return(0,s.jsx)(u,{className:(0,l.cn)(c({variant:r,size:o,className:a})),ref:t,...d})});i.displayName="Button"},8764:function(e,t,a){a.d(t,{RM:function(){return c},SC:function(){return i},iA:function(){return o},pj:function(){return u},ss:function(){return d},xD:function(){return l}});var s=a(5893),r=a(7294),n=a(2350);let o=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:t,className:(0,n.cn)("w-full caption-bottom text-base",a),...r})})});o.displayName="Table";let l=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)("thead",{ref:t,className:(0,n.cn)("[&_tr]:border-b",a),...r})});l.displayName="TableHeader";let c=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)("tbody",{ref:t,className:(0,n.cn)("[&_tr:last-child]:border-0",a),...r})});c.displayName="TableBody",r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)("tfoot",{ref:t,className:(0,n.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...r})}).displayName="TableFooter";let i=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)("tr",{ref:t,className:(0,n.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...r})});i.displayName="TableRow";let d=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)("th",{ref:t,className:(0,n.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",a),...r})});d.displayName="TableHead";let u=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)("td",{ref:t,className:(0,n.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",a),...r})});u.displayName="TableCell",r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)("caption",{ref:t,className:(0,n.cn)("mt-4 text-base text-muted-foreground",a),...r})}).displayName="TableCaption"},3266:function(e,t,a){a.d(t,{QL:function(){return d},Sl:function(){return c},zd:function(){return l}});var s=a(7294),r=a(5821),n=a(3225);let o={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function l(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=(await fetch("".concat(n.f4,"/status"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cluster_names:e,all_users:!0})})).headers.get("x-request-id"),a=await fetch("".concat(n.f4,"/api/get?request_id=").concat(t)),s=await a.json();return(s.return_value?JSON.parse(s.return_value):[]).map(e=>({status:o[e.status],cluster:e.name,user:e.user_name,infra:e.cloud,region:e.region,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,jobs:[],events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}))}catch(e){return console.error("Error fetching clusters:",e),[]}}async function c(e){let{clusterName:t,jobId:a,onNewLog:s}=e;try{let e=(await fetch("".concat(n.f4,"/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({follow:!1,cluster_name:t,job_id:a})})).body.getReader();for(;;){let{done:t,value:a}=await e.read();if(t)break;let r=new TextDecoder().decode(a);s(r)}}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,r.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function i(e){let{clusterName:t}=e;try{let e=(await fetch("".concat(n.f4,"/queue"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cluster_name:t,all_users:!0})})).headers.get("x-request-id"),a=await fetch("".concat(n.f4,"/api/get?request_id=").concat(e)),s=await a.json();return JSON.parse(s.return_value).map(e=>{let a=e.end_at?e.end_at:Date.now()/1e3,s=0,r=0;return e.submitted_at&&(s=a-e.submitted_at),e.start_at&&(r=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:s,job_duration:r,infra:"",logs:""}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function d(e){let{cluster:t,job:a=null}=e,[r,n]=(0,s.useState)(null),[o,c]=(0,s.useState)(null),[d,u]=(0,s.useState)(!0),[f,m]=(0,s.useState)(!0),x=(0,s.useCallback)(async()=>{if(t)try{u(!0);let e=await l({clusterNames:[t]});n(e[0])}catch(e){console.error("Error fetching cluster data:",e)}finally{u(!1)}},[t]),h=(0,s.useCallback)(async()=>{if(t)try{m(!0);let e=await i({clusterName:t,job:a});c(e)}catch(e){console.error("Error fetching cluster job data:",e)}finally{m(!1)}},[t,a]),p=(0,s.useCallback)(async()=>{await Promise.all([x(),h()])},[x,h]);return(0,s.useEffect)(()=>{x(),h()},[t,a,x,h]),{clusterData:r,clusterJobData:o,loading:d||f,refreshData:p}}},4545:function(e,t,a){function s(e){return e.startsWith("sky-jobs-controller-")}function r(e,t,a){return null===t?e:[...e].sort((e,s)=>e[t]<s[t]?"ascending"===a?-1:1:e[t]>s[t]?"ascending"===a?1:-1:0)}a.d(t,{R0:function(){return r},Ym:function(){return s}})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[979],{9307:function(e,t,n){n.d(t,{Cl:function(){return l},OE:function(){return d}});var r=n(5893);n(7294);var s=n(8799),a=n(7469),o=n(3850);let l=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"RUNNING":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"TERMINATED":default:return"bg-gray-100 text-gray-800";case"PENDING":case"CANCELLED":case"CANCELLING":return"bg-yellow-50 text-yellow-700";case"SUCCEEDED":return"bg-blue-50 text-blue-700";case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":return"bg-red-50 text-red-700";case"RECOVERING":return"bg-orange-50 text-orange-700";case"SUBMITTED":return"bg-indigo-50 text-indigo-700";case"STARTING":return"bg-cyan-50 text-cyan-700";case"FAILED_SETUP":return"bg-pink-50 text-pink-700"}},i=e=>{switch(e){case"LAUNCHING":case"STARTING":return(0,r.jsx)(s.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":default:return(0,r.jsx)(o.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,r.jsx)(o.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,r.jsx)(o.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,r.jsx)(o.Ye,{className:"w-3 h-3 mr-1"});case"PENDING":case"RECOVERING":case"SUBMITTED":case"CANCELLING":case"FAILED_SETUP":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":return(0,r.jsx)(o.J$,{className:"w-3 h-3 mr-1"})}},c=e=>{let t=l(e),n=i(e);return(0,r.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(t),children:[n,e]})},d=e=>{let{status:t}=e;return(0,r.jsx)(a.WH,{content:t,className:"text-muted-foreground text-sm",children:(0,r.jsx)("span",{children:c(t)})})}},3850:function(e,t,n){n.d(t,{J$:function(){return o},Ps:function(){return s},QT:function(){return c},Vp:function(){return d},W2:function(){return a},Ye:function(){return l},aD:function(){return f},fp:function(){return i},fy:function(){return x},h0:function(){return h},mU:function(){return m},yN:function(){return u}});var r=n(5893);function s(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})})}function a(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function o(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function l(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M6 12l4 4 8-8"})})}function i(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1"}),(0,r.jsx)("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1"})]})}function c(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,r.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,r.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,r.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}function d(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"}),(0,r.jsx)("rect",{width:"20",height:"14",x:"2",y:"6",rx:"2"})]})}function u(e){return(0,r.jsxs)("svg",{...e,viewBox:"0 0 423.683 423.683",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",xmlSpace:"preserve",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("g",{id:"SVGRepo_bgCarrier",strokeWidth:"0"}),(0,r.jsx)("g",{id:"SVGRepo_tracerCarrier",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("g",{id:"SVGRepo_iconCarrier",children:(0,r.jsx)("g",{children:(0,r.jsx)("path",{d:"M54.376,287.577h310.459c26.48,0,48.02-13.979,48.02-40.453c0-17.916-10.001-34.07-25.559-42.292 c-19.021-72.951-86.061-125.196-162.002-125.223v-3.431h-3.854V61.814h3.854v-9.569h-31.38v9.569h3.854v14.363h-3.854v3.431 c-75.941,0.026-142.97,52.272-161.988,125.217c-15.56,8.216-25.573,24.376-25.573,42.291 C6.36,273.597,27.896,287.577,54.376,287.577z M47.676,227.145l7.214-2.424l1.617-7.447 c13.884-64.232,71.707-110.862,137.467-110.862h31.274c65.763,0,123.582,46.63,137.473,110.862l1.607,7.447l7.223,2.424 c8.678,2.92,14.506,10.946,14.506,19.979c0,11.703-9.517,13.647-21.221,13.647H54.376c-11.7,0-21.22-1.944-21.22-13.647 C33.162,238.091,38.984,230.065,47.676,227.145z M423.683,334.602v36.836H0v-36.836h25.348v-18.418h372.99v18.418H423.683z"})})})]})}function h(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),(0,r.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,r.jsx)("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function x(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}function m(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{transform:"scale(0.85) translate(1.8, 1.8)",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})})}function f(e){return(0,r.jsx)("svg",{...e,stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,r.jsx)("path",{d:"M6.455 19L2 22.5V4a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6.455zM4 18.385L5.763 17H20V5H4v13.385zM11 13h2v2h-2v-2zm0-6h2v5h-2V7z"})]})})}n(7294)},9470:function(e,t,n){n.d(t,{A:function(){return w}});var r=n(5893),s=n(7294),a=n(5675),o=n.n(a),l=n(1163),i=n(1664),c=n.n(i),d=n(3850),u=n(3225),h=n(7469),x=n(3001);let m=(0,s.createContext)(null);function f(e){let{children:t}=e,[n,a]=(0,s.useState)(!0);return(0,r.jsx)(m.Provider,{value:{isSidebarOpen:n,toggleSidebar:()=>{a(e=>!e)}},children:t})}function p(){let e=(0,l.useRouter)(),t=(0,x.X)(),n=t=>e.pathname.startsWith(t),s=e=>{let r=n(e);return"inline-flex items-center border-b-2 ".concat(r?"border-transparent text-blue-600":"border-transparent hover:text-blue-600"," ").concat(t?"px-2 py-1":"px-1 pt-1 space-x-2")};return(0,r.jsx)("div",{className:"fixed top-0 left-0 right-0 bg-white z-30 h-14 px-4 border-b border-gray-200 shadow-sm",children:(0,r.jsxs)("div",{className:"flex items-center h-full",children:[(0,r.jsx)("div",{className:"flex items-center ".concat(t?"space-x-2 mr-2":"space-x-4 mr-6"),children:(0,r.jsx)(c(),{href:"/",className:"flex items-center px-1 pt-1 h-full",prefetch:!1,children:(0,r.jsx)("div",{className:"".concat(t?"h-16 w-16":"h-20 w-20"," flex items-center justify-center"),children:(0,r.jsx)(o(),{src:"".concat(u.GW,"/skypilot.svg"),alt:"SkyPilot Logo",width:80,height:80,priority:!0,className:"w-full h-full object-contain"})})})}),(0,r.jsxs)("div",{className:"flex items-center ".concat(t?"space-x-1":"space-x-2 md:space-x-6"," ").concat(t?"mr-2":"mr-6"),children:[(0,r.jsxs)(c(),{href:"/clusters",className:s("/clusters"),prefetch:!1,children:[(0,r.jsx)(d.QT,{className:"w-4 h-4"}),!t&&(0,r.jsx)("span",{children:"Clusters"})]}),(0,r.jsxs)(c(),{href:"/jobs",className:s("/jobs"),prefetch:!1,children:[(0,r.jsx)(d.Vp,{className:"w-4 h-4"}),!t&&(0,r.jsx)("span",{children:"Jobs"})]}),(0,r.jsxs)("div",{className:"inline-flex items-center ".concat(t?"px-2 py-1":"px-1 pt-1"," text-gray-400"),children:[(0,r.jsx)(d.yN,{className:"w-4 h-4"}),!t&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"ml-2",children:"Services"}),(0,r.jsx)("span",{className:"text-xs ml-2 px-1.5 py-0.5 bg-gray-100 text-gray-500 rounded",children:"Soon"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-1 ".concat(t?"ml-0":"ml-auto"),children:[(0,r.jsx)(h.WH,{content:"Documentation",className:"text-sm text-muted-foreground",children:(0,r.jsxs)("a",{href:"https://skypilot.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-2 py-1 text-gray-600 hover:text-blue-600 transition-colors duration-150 cursor-pointer",title:"Docs",children:[!t&&(0,r.jsx)("span",{className:"mr-1",children:"Docs"}),(0,r.jsx)(d.h0,{className:"".concat(t?"w-4 h-4":"w-3.5 h-3.5")})]})}),(0,r.jsx)("div",{className:"border-l border-gray-200 h-6 mx-1"}),(0,r.jsx)(h.WH,{content:"GitHub Repository",className:"text-sm text-muted-foreground",children:(0,r.jsx)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"GitHub",children:(0,r.jsx)(d.fy,{className:"".concat(t?"w-4 h-4":"w-5 h-5")})})}),(0,r.jsx)(h.WH,{content:"Join Slack",className:"text-sm text-muted-foreground",children:(0,r.jsx)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Slack",children:(0,r.jsx)(d.mU,{className:"".concat(t?"w-4 h-4":"w-5 h-5")})})}),(0,r.jsx)(h.WH,{content:"Leave Feedback",className:"text-sm text-muted-foreground",children:(0,r.jsx)("a",{href:"https://github.com/skypilot-org/skypilot/issues/new",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Leave Feedback",children:(0,r.jsx)(d.aD,{className:"".concat(t?"w-4 h-4":"w-5 h-5")})})})]})]})})}function g(e){let{children:t,highlighted:n}=e;return(0,x.X)(),(0,r.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,r.jsx)("div",{className:"fixed top-0 left-0 right-0 z-50 shadow-sm",children:(0,r.jsx)(p,{})}),(0,r.jsx)("div",{className:"transition-all duration-200 ease-in-out min-h-screen",style:{paddingTop:"56px"},children:(0,r.jsx)("main",{className:"p-6",children:t})})]})}function w(e){return(0,r.jsx)(f,{children:(0,r.jsx)(g,{...e})})}},7673:function(e,t,n){n.d(t,{Zb:function(){return o}});var r=n(5893),s=n(7294),a=n(2350);let o=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,a.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",n),...s})});o.displayName="Card",s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,a.cn)("flex flex-col space-y-1.5 p-6",n),...s})}).displayName="CardHeader",s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)("h3",{ref:t,className:(0,a.cn)("text-2xl font-semibold leading-none tracking-tight",n),...s})}).displayName="CardTitle",s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)("p",{ref:t,className:(0,a.cn)("text-sm text-muted-foreground",n),...s})}).displayName="CardDescription",s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,a.cn)("p-6 pt-0",n),...s})}).displayName="CardContent",s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,a.cn)("flex items-center p-6 pt-0",n),...s})}).displayName="CardFooter"},7469:function(e,t,n){n.d(t,{WH:function(){return b},$B:function(){return E},LU:function(){return k},q8:function(){return C},GV:function(){return v}});var r=n(5893),s=n(7294),a=n(9515),o=n(1886),l=n(4461),i=n(5895),c=n(7242),d=n(282),u=n(2350);let h=l.fC;l.ZA;let x=l.B4,m=s.forwardRef((e,t)=>{let{className:n,children:s,...a}=e;return(0,r.jsxs)(l.xz,{ref:t,className:(0,u.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...a,children:[s,(0,r.jsx)(l.JO,{asChild:!0,children:(0,r.jsx)(i.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=l.xz.displayName;let f=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(l.u_,{ref:t,className:(0,u.cn)("flex cursor-default items-center justify-center py-1",n),...s,children:(0,r.jsx)(c.Z,{className:"h-4 w-4"})})});f.displayName=l.u_.displayName;let p=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(l.$G,{ref:t,className:(0,u.cn)("flex cursor-default items-center justify-center py-1",n),...s,children:(0,r.jsx)(i.Z,{className:"h-4 w-4"})})});p.displayName=l.$G.displayName;let g=s.forwardRef((e,t)=>{let{className:n,children:s,position:a="popper",...o}=e;return(0,r.jsx)(l.h_,{children:(0,r.jsxs)(l.VY,{ref:t,className:(0,u.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:a,...o,children:[(0,r.jsx)(f,{}),(0,r.jsx)(l.l_,{className:(0,u.cn)("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,r.jsx)(p,{})]})})});g.displayName=l.VY.displayName,s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(l.__,{ref:t,className:(0,u.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...s})}).displayName=l.__.displayName;let w=s.forwardRef((e,t)=>{let{className:n,children:s,...a}=e;return(0,r.jsxs)(l.ck,{ref:t,className:(0,u.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...a,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(l.wU,{children:(0,r.jsx)(d.Z,{className:"h-4 w-4"})})}),(0,r.jsx)(l.eT,{children:s})]})});function j(e){return e.charAt(0).toUpperCase()+e.slice(1)}function v(e){if(!e)return"N/A";let t=new Date;return 7>Math.abs((t-e)/864e5)?(0,r.jsx)(b,{content:N(e),className:"capitalize text-sm text-muted-foreground",children:j((0,o.B)(e,t,{addSuffix:!0}))}):(0,r.jsx)(b,{content:j(N(e)),className:"text-sm text-muted-foreground",children:j(e.toLocaleString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).replace(",",""))})}function N(e){return e.toLocaleString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZoneName:"short"}).replace(",","")}w.displayName=l.ck.displayName,s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(l.Z0,{ref:t,className:(0,u.cn)("-mx-1 my-1 h-px bg-muted",n),...s})}).displayName=l.Z0.displayName;let y={placement:"bottom",color:"default"},b=e=>{let{children:t,...n}=e,s=n.content;return n.content=void 0,(0,r.jsx)(a.e,{...y,...n,content:(0,r.jsx)("span",{className:"left-full w-max px-2 py-1 text-sm text-gray-100 bg-gray-500 text-sm capitalize rounded",children:s}),children:t})};function k(e){if(!e&&0!==e)return"-";let t=e=Math.floor(e),n="",r=0;for(let e of[{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(t>=e.value&&r<2){let s=Math.floor(t/e.value);n+="".concat(s).concat(e.label," "),t%=e.value,r++}return n.trim()||"0s"}function C(e){return e?(e=e.split("\n").filter(e=>!e.match(/<rich_.*?\[bold cyan\]/)&&!e.match(/<rich_.*>.*<\/rich_.*>/)&&!e.match(/├──/)&&!e.match(/└──/)).join("\n").replace(/\x1b\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGKH]/g,"")).split("\n").map(e=>{let t=e.match(/^([IWED])\s+(\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+([^:]+:\d+\])(.*)/);if(t){let[e,n,r,s,a]=t,o={I:"INFO",W:"WARNING",E:"ERROR",D:"DEBUG"}[n]||"";return'<span class="log-line '.concat(o,'"><span class="level">').concat(n,'</span><span class="timestamp">').concat(r,'</span><span class="location">').concat(s,'</span><span class="message">').concat(a,"</span></span>")}let n=e.match(/^(\([^)]+\))(.*)$/);if(n){let[e,t,r]=n;return'<span class="log-line"><span class="log-prefix">'.concat(t,'</span><span class="log-rest">').concat(r,"</span></span>")}return'<span class="log-line"><span class="message">'.concat(e,"</span></span>")}).join("\n"):""}function E(e){let{logs:t,controller:n=!1}=e,[a,o]=(0,s.useState)("all"),[l,i]=(0,s.useState)(t),[c,d]=(0,s.useState)([]);return(0,s.useEffect)(()=>{d(function(e){let t;let n=/\((head|worker\d+),/g,r=new Set;for(;null!==(t=n.exec(e));)r.add(t[1]);return Array.from(r).sort((e,t)=>"head"===e?-1:"head"===t?1:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"}))}(t))},[t]),(0,s.useEffect)(()=>{"all"===a?i(t):i(t.split("\n").filter(e=>e.includes("(".concat(a,","))).join("\n"))},[a,t]),(0,r.jsxs)("div",{children:[(0,r.jsx)("style",{children:'\n .logs-container {\n background-color: #f7f7f7;\n padding: 16px;\n max-height: calc(100vh - 300px);\n overflow-y: auto;\n overflow-x: hidden;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;\n line-height: 1.5;\n border-radius: 6px;\n min-height: fit-content;\n }\n\n .log-line {\n display: block;\n white-space: pre-wrap;\n margin: 2px 0;\n }\n\n .log-line .level {\n display: inline;\n width: 1ch;\n margin-right: 1ch;\n font-weight: bold;\n }\n\n .log-line.INFO .level {\n color: #2563eb;\n }\n\n .log-line.WARNING .level {\n color: #d97706;\n }\n\n .log-line.ERROR .level {\n color: #dc2626;\n }\n\n .log-line.DEBUG .level {\n color: #6b7280;\n }\n\n .log-line .timestamp {\n color: #059669;\n margin-right: 1ch;\n white-space: nowrap;\n }\n\n .log-line .location {\n color: #6366f1;\n margin-right: 1ch;\n white-space: nowrap;\n }\n\n .log-line .message {\n color: #111827;\n word-break: break-word;\n white-space: pre-wrap;\n }\n\n .log-line .log-prefix {\n color: #6366f1;\n font-weight: 500;\n }\n\n .log-line .log-rest {\n color: #111827;\n word-break: break-word;\n white-space: pre-wrap;\n }\n'}),!n&&(0,r.jsx)("div",{style:{marginBottom:"1rem"},children:(0,r.jsxs)(h,{onValueChange:e=>o(e),value:a,children:[(0,r.jsx)(m,{"aria-label":"Node",className:"focus:ring-0 focus:ring-offset-0",children:(0,r.jsx)(x,{placeholder:"Select Node"})}),(0,r.jsxs)(g,{children:[(0,r.jsx)(w,{value:"all",children:"All Nodes"}),c.map(e=>(0,r.jsx)(w,{value:e,children:e},e))]})]})}),(0,r.jsx)("div",{className:"logs-container",dangerouslySetInnerHTML:{__html:C(l)}})]})}},5821:function(e,t,n){n.d(t,{C:function(){return r}});function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,r=document.getElementById("toast-container");r||((r=document.createElement("div")).id="toast-container",r.className="fixed top-0 right-0 p-4 z-[9999] flex flex-col items-end space-y-2",document.body.appendChild(r));let s=document.createElement("div");switch(s.className="rounded-md border-l-4 p-4 shadow-md flex items-center justify-between max-w-md w-full mb-2 pointer-events-auto",t){case"success":s.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":s.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":s.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:s.className+=" bg-blue-100 border-blue-500 text-blue-800"}return s.innerHTML='\n <div class="flex-1 mr-2">\n <p class="text-sm font-medium">'.concat(e,'</p>\n </div>\n <button class="text-gray-500 hover:text-gray-700 focus:outline-none" aria-label="Close toast">\n <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>\n </button>\n '),r.appendChild(s),s.querySelector("button").addEventListener("click",()=>{r.removeChild(s)}),setTimeout(()=>{r.contains(s)&&r.removeChild(s)},n),s}},3001:function(e,t,n){n.d(t,{X:function(){return s}});var r=n(7294);function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,n]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let t=()=>{n(window.innerWidth<e)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e]),t}},2350:function(e,t,n){n.d(t,{cn:function(){return a}});var r=n(512),s=n(8388);function a(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,s.m6)((0,r.W)(t))}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[826],{4966:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters/[cluster]/[job]",function(){return t(190)}])},3266:function(e,s,t){"use strict";t.d(s,{QL:function(){return d},Sl:function(){return i},zd:function(){return l}});var r=t(7294),a=t(5821),n=t(3225);let c={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function l(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let s=(await fetch("".concat(n.f4,"/status"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cluster_names:e,all_users:!0})})).headers.get("x-request-id"),t=await fetch("".concat(n.f4,"/api/get?request_id=").concat(s)),r=await t.json();return(r.return_value?JSON.parse(r.return_value):[]).map(e=>({status:c[e.status],cluster:e.name,user:e.user_name,infra:e.cloud,region:e.region,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,jobs:[],events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}))}catch(e){return console.error("Error fetching clusters:",e),[]}}async function i(e){let{clusterName:s,jobId:t,onNewLog:r}=e;try{let e=(await fetch("".concat(n.f4,"/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({follow:!1,cluster_name:s,job_id:t})})).body.getReader();for(;;){let{done:s,value:t}=await e.read();if(s)break;let a=new TextDecoder().decode(t);r(a)}}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,a.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function o(e){let{clusterName:s}=e;try{let e=(await fetch("".concat(n.f4,"/queue"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cluster_name:s,all_users:!0})})).headers.get("x-request-id"),t=await fetch("".concat(n.f4,"/api/get?request_id=").concat(e)),r=await t.json();return JSON.parse(r.return_value).map(e=>{let t=e.end_at?e.end_at:Date.now()/1e3,r=0,a=0;return e.submitted_at&&(r=t-e.submitted_at),e.start_at&&(a=t-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:s,total_duration:r,job_duration:a,infra:"",logs:""}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function d(e){let{cluster:s,job:t=null}=e,[a,n]=(0,r.useState)(null),[c,i]=(0,r.useState)(null),[d,u]=(0,r.useState)(!0),[m,x]=(0,r.useState)(!0),h=(0,r.useCallback)(async()=>{if(s)try{u(!0);let e=await l({clusterNames:[s]});n(e[0])}catch(e){console.error("Error fetching cluster data:",e)}finally{u(!1)}},[s]),f=(0,r.useCallback)(async()=>{if(s)try{x(!0);let e=await o({clusterName:s,job:t});i(e)}catch(e){console.error("Error fetching cluster job data:",e)}finally{x(!1)}},[s,t]),j=(0,r.useCallback)(async()=>{await Promise.all([h(),f()])},[h,f]);return(0,r.useEffect)(()=>{h(),f()},[s,t,h,f]),{clusterData:a,clusterJobData:c,loading:d||m,refreshData:j}}},190:function(e,s,t){"use strict";t.r(s),t.d(s,{JobDetailPage:function(){return b}});var r=t(5893),a=t(7294),n=t(9470),c=t(7673),l=t(1664),i=t.n(l),o=t(1163),d=t(3266),u=t(7469),m=t(3626),x=t(8799),h=t(9307),f=t(3001);function j(e){let{cluster:s,job:t,jobData:a,onRefresh:n,isRefreshing:c,loading:l}=e,o=(0,f.X)();return(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:"/clusters",className:"text-sky-blue hover:underline",children:"Sky Clusters"}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsx)(i(),{href:"/clusters/".concat(s),className:"text-sky-blue hover:underline",children:s}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsxs)(i(),{href:"/clusters/".concat(s,"/").concat(t),className:"text-sky-blue hover:underline",children:[t,a.job&&"-"!=a.job?" (".concat(a.job,")"):""]})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[(l||c)&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(x.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"text-sm ml-2 text-gray-500",children:"Loading..."})]}),(0,r.jsx)(u.WH,{content:"Refresh",className:"text-muted-foreground",children:(0,r.jsxs)("button",{onClick:n,disabled:l||c,className:"text-sm text-sky-blue hover:text-sky-blue-bright font-medium mx-2 flex items-center",children:[(0,r.jsx)(m.Z,{className:"w-4 h-4 mr-1.5"}),!o&&(0,r.jsx)("span",{children:"Refresh"})]})})]})]})}function b(){let e=(0,o.useRouter)(),{cluster:s,job:t}=e.query,{clusterData:l,clusterJobData:f,loading:b,refreshData:N}=(0,d.QL)({cluster:s}),[g,y]=(0,a.useState)(!1),[v,p]=(0,a.useState)(!0),[_,w]=(0,a.useState)(!1),[S,E]=(0,a.useState)([]),[k,C]=(0,a.useState)(!1),T=(0,a.useMemo)(()=>["INIT","PENDING","SETTING_UP"],[]),P=(0,a.useMemo)(()=>{if(!f||!t)return!0;let e=f.find(e=>e.id==t);return e&&T.includes(e.status)},[f,t,T]);a.useEffect(()=>{!b&&v&&p(!1)},[b,v]),(0,a.useEffect)(()=>{let e=!0;return s&&t&&!P?(w(!0),(0,d.Sl)({clusterName:s,jobId:t,onNewLog:s=>{if(e){let e=(0,u.q8)(s);E(s=>[...s,e])}}}).then(()=>{e&&w(!1)}).catch(s=>{e&&(console.error("Error streaming logs:",s),w(!1))})):w(!1),()=>{e=!1}},[s,t,k,P]);let D=async()=>{y(!0),C(e=>!e),E([]);try{N&&await N()}catch(e){console.error("Error refreshing data:",e)}finally{y(!1)}};if(!e.isReady)return(0,r.jsx)("div",{children:"Loading..."});let O={id:t};if(l&&f){let e=f.find(e=>e.id==t);e&&(O={...e,infra:l.infra,cluster:l.cluster,user:l.user})}return(0,r.jsxs)(n.A,{highlighted:"clusters",children:[(0,r.jsx)(j,{cluster:s,job:t,jobData:O,onRefresh:D,isRefreshing:g,loading:b}),b&&v?(0,r.jsxs)("div",{className:"flex items-center justify-center h-64",children:[(0,r.jsx)(x.Z,{size:24,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsx)("div",{id:"details",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Details"})}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job ID"}),(0,r.jsx)("div",{className:"text-base mt-1",children:O.id})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job Name"}),(0,r.jsx)("div",{className:"text-base mt-1",children:O.job})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsx)(h.OE,{status:O.status})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,r.jsx)("div",{className:"text-base mt-1",children:O.user})]}),O.resources&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Resources"}),(0,r.jsx)("div",{className:"text-base mt-1",children:O.resources||"N/A"})]}),O.cluster&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cluster"}),(0,r.jsx)("div",{className:"text-base mt-1",children:(0,r.jsx)(i(),{href:"/clusters/".concat(O.cluster),className:"text-sky-blue hover:underline",children:O.cluster})})]})]})})]})}),(0,r.jsx)("div",{id:"logs",className:"mt-6",children:(0,r.jsxs)(c.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Logs"}),(0,r.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:"(Logs are not streaming; click refresh to fetch the latest logs.)"})]}),(0,r.jsx)(u.WH,{content:"Refresh logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>{C(e=>!e),E([])},disabled:_,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(m.Z,{className:"w-4 h-4 ".concat(_?"animate-spin":"")})})})]}),(0,r.jsx)("div",{className:"p-4",children:P?(0,r.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,r.jsx)("span",{children:"Waiting for the job to start, please refresh after a while"})}):_?(0,r.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,r.jsx)(x.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",children:(0,r.jsx)(u.$B,{logs:S.join("")})})})]})})]})]})}s.default=b}},function(e){e.O(0,[678,979,888,774,179],function(){return e(e.s=4966)}),_N_E=e.O()}]);