skypilot-nightly 1.0.0.dev20250602__py3-none-any.whl → 1.0.0.dev20250603__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sky/__init__.py +2 -2
- sky/client/sdk.py +3 -4
- sky/clouds/gcp.py +3 -6
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/chunks/236-fef38aa6e5639300.js +6 -0
- sky/dashboard/out/_next/static/chunks/37-947904ccc5687bac.js +6 -0
- sky/dashboard/out/_next/static/chunks/682-2be9b0f169727f2f.js +6 -0
- sky/dashboard/out/_next/static/chunks/856-f1b1f7f47edde2e8.js +1 -0
- sky/dashboard/out/_next/static/chunks/969-d7b6fb7f602bfcb3.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-158b70da336d8607.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-62c9982dc3675725.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/{clusters-f37ff20f0af29aae.js → clusters-5549a350f97d7ef3.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/config-35383adcb0edb5e2.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/infra/{[context]-342bc15bb78ab2e5.js → [context]-b68ddeed712d45b5.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/{infra-7b4b8e7fa9fa0827.js → infra-13b117a831702196.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-a62a3c65dc9bc57c.js +11 -0
- sky/dashboard/out/_next/static/chunks/pages/{jobs-78a6c5ba3e24c0cf.js → jobs-a76b2700eca236f7.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/{users-89f9212b81d8897e.js → users-07b523ccb19317ad.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/workspace/{new-198b6e00d7d724c5.js → new-c7516f2b4c3727c0.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces/{[name]-2ce792183b03c341.js → [name]-7799de9e691e35d8.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces-f54921ec9eb20965.js +1 -0
- sky/dashboard/out/_next/static/css/63d3995d8b528eb1.css +3 -0
- sky/dashboard/out/_next/static/zTAFq_Iv6_yxQj3fXvJWR/_buildManifest.js +1 -0
- sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
- sky/dashboard/out/clusters/[cluster].html +1 -1
- sky/dashboard/out/clusters.html +1 -1
- sky/dashboard/out/config.html +1 -1
- sky/dashboard/out/index.html +1 -1
- sky/dashboard/out/infra/[context].html +1 -1
- sky/dashboard/out/infra.html +1 -1
- sky/dashboard/out/jobs/[job].html +1 -1
- sky/dashboard/out/jobs.html +1 -1
- sky/dashboard/out/users.html +1 -1
- sky/dashboard/out/workspace/new.html +1 -1
- sky/dashboard/out/workspaces/[name].html +1 -1
- sky/dashboard/out/workspaces.html +1 -1
- sky/execution.py +1 -2
- sky/global_user_state.py +1 -1
- sky/jobs/utils.py +31 -1
- sky/provision/gcp/constants.py +4 -0
- sky/resources.py +31 -0
- sky/server/common.py +86 -53
- sky/server/stream_utils.py +38 -2
- sky/utils/controller_utils.py +4 -14
- {skypilot_nightly-1.0.0.dev20250602.dist-info → skypilot_nightly-1.0.0.dev20250603.dist-info}/METADATA +1 -1
- {skypilot_nightly-1.0.0.dev20250602.dist-info → skypilot_nightly-1.0.0.dev20250603.dist-info}/RECORD +53 -52
- sky/dashboard/out/_next/static/chunks/236-7458fda7b295f305.js +0 -6
- sky/dashboard/out/_next/static/chunks/37-b638675d511d58b4.js +0 -6
- sky/dashboard/out/_next/static/chunks/682-5c12535476a21ce3.js +0 -6
- sky/dashboard/out/_next/static/chunks/856-ab9627e7e8ac35e8.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-8f270e2c9c59fa1a.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-25edb867a41b6b20.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/config-3c6a2dabf56e8cd6.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-c0c1dff3cd463d9e.js +0 -11
- sky/dashboard/out/_next/static/chunks/pages/workspaces-17d41826537196e7.js +0 -1
- sky/dashboard/out/_next/static/css/2b3ee34e586949a3.css +0 -3
- sky/dashboard/out/_next/static/dev-ndwjPgd_uQ4dcXXiv/_buildManifest.js +0 -1
- /sky/dashboard/out/_next/static/chunks/{843-786c36624d5ff61f.js → 843-a097338acb89b7d7.js} +0 -0
- /sky/dashboard/out/_next/static/chunks/pages/{_app-ad1edd7fe17ea796.js → _app-67925f5e6382e22f.js} +0 -0
- /sky/dashboard/out/_next/static/{dev-ndwjPgd_uQ4dcXXiv → zTAFq_Iv6_yxQj3fXvJWR}/_ssgManifest.js +0 -0
- {skypilot_nightly-1.0.0.dev20250602.dist-info → skypilot_nightly-1.0.0.dev20250603.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250602.dist-info → skypilot_nightly-1.0.0.dev20250603.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250602.dist-info → skypilot_nightly-1.0.0.dev20250603.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250602.dist-info → skypilot_nightly-1.0.0.dev20250603.dist-info}/top_level.txt +0 -0
sky/__init__.py
CHANGED
@@ -5,7 +5,7 @@ from typing import Optional
|
|
5
5
|
import urllib.request
|
6
6
|
|
7
7
|
# Replaced with the current commit when building the wheels.
|
8
|
-
_SKYPILOT_COMMIT_SHA = '
|
8
|
+
_SKYPILOT_COMMIT_SHA = 'c571c1f931047cf26b3522d34b0fe1cc06749f3b'
|
9
9
|
|
10
10
|
|
11
11
|
def _get_git_commit():
|
@@ -35,7 +35,7 @@ def _get_git_commit():
|
|
35
35
|
|
36
36
|
|
37
37
|
__commit__ = _get_git_commit()
|
38
|
-
__version__ = '1.0.0.
|
38
|
+
__version__ = '1.0.0.dev20250603'
|
39
39
|
__root_dir__ = os.path.dirname(os.path.abspath(__file__))
|
40
40
|
|
41
41
|
|
sky/client/sdk.py
CHANGED
@@ -2022,6 +2022,7 @@ def api_login(endpoint: Optional[str] = None, get_token: bool = False) -> None:
|
|
2022
2022
|
expires = int(time.time()) + 604800
|
2023
2023
|
domain = str(parsed_url.hostname)
|
2024
2024
|
domain_initial_dot = domain.startswith('.')
|
2025
|
+
secure = parsed_url.scheme == 'https'
|
2025
2026
|
if not domain_initial_dot:
|
2026
2027
|
domain = '.' + domain
|
2027
2028
|
|
@@ -2037,7 +2038,7 @@ def api_login(endpoint: Optional[str] = None, get_token: bool = False) -> None:
|
|
2037
2038
|
domain_initial_dot=domain_initial_dot,
|
2038
2039
|
path='',
|
2039
2040
|
path_specified=False,
|
2040
|
-
secure=
|
2041
|
+
secure=secure,
|
2041
2042
|
expires=expires,
|
2042
2043
|
discard=False,
|
2043
2044
|
comment=None,
|
@@ -2046,9 +2047,7 @@ def api_login(endpoint: Optional[str] = None, get_token: bool = False) -> None:
|
|
2046
2047
|
))
|
2047
2048
|
|
2048
2049
|
# Now that the cookies are parsed, save them to the cookie jar.
|
2049
|
-
|
2050
|
-
server_common.get_api_cookie_jar_path())
|
2051
|
-
cookie_jar.save(cookie_jar_path)
|
2050
|
+
server_common.set_api_cookie_jar(cookie_jar)
|
2052
2051
|
|
2053
2052
|
# If we have a user_hash, save it to the local file
|
2054
2053
|
if user_hash is not None:
|
sky/clouds/gcp.py
CHANGED
@@ -119,11 +119,6 @@ _DEFAULT_GPU_K80_IMAGE_ID = 'skypilot:k80-debian-10'
|
|
119
119
|
# Refer to https://github.com/GoogleCloudPlatform/cluster-toolkit/blob/main/examples/machine-learning/a3-highgpu-8g/README.md#before-starting
|
120
120
|
_DEFAULT_GPU_DIRECT_IMAGE_ID = 'skypilot:gpu-direct-cos'
|
121
121
|
|
122
|
-
# From https://cloud.google.com/compute/docs/gpus/gpudirect
|
123
|
-
# A specific image is used to ensure that the the GPU is configured with TCPX support.
|
124
|
-
_NETWORK_GCP_IMAGE_ID = ('docker:us-docker.pkg.dev/gce-ai-infra/gpudirect-tcpx/'
|
125
|
-
'nccl-plugin-gpudirecttcpx')
|
126
|
-
|
127
122
|
|
128
123
|
def _run_output(cmd):
|
129
124
|
proc = subprocess.run(cmd,
|
@@ -547,7 +542,9 @@ class GCP(clouds.Cloud):
|
|
547
542
|
acc.lower())
|
548
543
|
resources_vars['gpu_count'] = acc_count
|
549
544
|
if enable_gpu_direct or network_tier == resources_utils.NetworkTier.BEST:
|
550
|
-
|
545
|
+
# The actual image id is set in resources.py (see _try_validate_image_id)
|
546
|
+
# and reference GCP_GPU_DIRECT_IMAGE_ID
|
547
|
+
image_id = _DEFAULT_GPU_DIRECT_IMAGE_ID
|
551
548
|
else:
|
552
549
|
if acc == 'K80':
|
553
550
|
# Though the image is called cu113, it actually has later
|
sky/dashboard/out/404.html
CHANGED
@@ -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/
|
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/63d3995d8b528eb1.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/63d3995d8b528eb1.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-f27c9a32aa3d9c6d.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-67925f5e6382e22f.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-1be831200e60c5c0.js" defer=""></script><script src="/dashboard/_next/static/zTAFq_Iv6_yxQj3fXvJWR/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/zTAFq_Iv6_yxQj3fXvJWR/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";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":"zTAFq_Iv6_yxQj3fXvJWR","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 A},Nk:function(){return I},x2:function(){return R}});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),x=t(6989),u=t(8969),m=t(3266),p=t(7324),j=t(9470),f=t(3626),g=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 w=(0,g.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,g.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,g.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(9284),v=t(4545),k=t(9307),C=t(3001),S=t(8950),E=t(6378),L=t(6856);let R={active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]},M="__ALL_WORKSPACES__",_=e=>{if(!e)return"-";let s=(0,x.GV)(e);if(r.isValidElement(s)&&s.props&&s.props.children&&(s=r.isValidElement(s.props.children)&&s.props.children.props&&s.props.children.props.children?s.props.children.props.children:s.props.children),"string"!=typeof s)return s;if("just now"===s)return"now";let t=s.match(/^About\s+(\d+)\s+(\w+)\s+ago$/);if(t){let e=t[1],s=t[2],n={second:"sec",seconds:"secs",minute:"min",minutes:"mins",hour:"hr",hours:"hrs",day:"d",days:"d",month:"mo",months:"mos",year:"yr",years:"yrs"};if(n[s])return"~ ".concat(e," ").concat(n[s]," ago")}let n=s.match(/^a[n]?\s+(\w+)\s+ago$/);if(n){let e=n[1],s={second:"sec",minute:"min",hour:"hr",day:"d",month:"mo",year:"yr"};if(s[e])return"1 ".concat(s[e]," ago")}let a=s.match(/^(\d+)\s+(\w+)\s+ago$/);if(a){let e=a[1],s=a[2],t={seconds:"secs",minutes:"mins",hours:"hrs",days:"d",months:"mo",years:"yr"};if(t[s])return"".concat(e," ").concat(t[s]," ago")}return s};function I(){let e=(0,a.useRouter)(),[s,t]=(0,r.useState)(!1),l=r.useRef(null),[o,d]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),h=(0,C.X)(),[m,g]=(0,r.useState)(M),[w,b]=(0,r.useState)([]);return(0,r.useEffect)(()=>{e.isReady&&e.query.workspace&&g(Array.isArray(e.query.workspace)?e.query.workspace[0]:e.query.workspace)},[e.isReady,e.query.workspace]),(0,r.useEffect)(()=>{(async()=>{try{await L.ZP.preloadForPage("jobs");let e=await E.default.get(p.fX),s=Object.keys(e),t=(await E.default.get(u.getManagedJobs,[{allUsers:!0}])).jobs||[],n=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],r=new Set(s);n.forEach(e=>r.add(e)),b(Array.from(r).sort())}catch(e){console.error("Error fetching data for workspace filter:",e),b(["default"])}})()},[]),(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.jsxs)("div",{className:"text-base flex items-center",children:[(0,n.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"}),(0,n.jsxs)(S.Ph,{value:m,onValueChange:g,children:[(0,n.jsx)(S.i4,{className:"h-8 w-48 ml-4 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,n.jsx)(S.ki,{placeholder:"Filter by workspace...",children:m===M?"All Workspaces":m})}),(0,n.jsxs)(S.Bw,{children:[(0,n.jsx)(S.Ql,{value:M,children:"All Workspaces"}),w.map(e=>(0,n.jsx)(S.Ql,{value:e,children:e},e))]})]})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(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)("button",{onClick:()=>{E.default.invalidate(u.getManagedJobs,[{allUsers:!0}]),E.default.invalidate(p.fX),l.current&&l.current()},disabled:s,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",title:"Refresh",children:[(0,n.jsx)(f.Z,{className:"h-4 w-4 mr-1.5"}),!h&&(0,n.jsx)("span",{children:"Refresh"})]})]})]}),(0,n.jsx)(O,{refreshInterval:x.yc,setLoading:t,refreshDataRef:l,workspaceFilter:m}),(0,n.jsx)(y.cV,{isOpen:o.isOpen,onClose:()=>d({...o,isOpen:!1}),onConfirm:o.onConfirm,title:o.title,message:o.message})]})}function O(e){let{refreshInterval:s,setLoading:t,refreshDataRef:a,workspaceFilter:l}=e,[p,j]=(0,r.useState)([]),[f,g]=(0,r.useState)({key:null,direction:"ascending"}),[b,N]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!0),[L,I]=(0,r.useState)(1),[O,A]=(0,r.useState)(10),[F,U]=(0,r.useState)(null),W=(0,r.useRef)(null),[Z,q]=(0,r.useState)([]),[T,V]=(0,r.useState)({}),[J,B]=(0,r.useState)(!1),[G,H]=(0,r.useState)(!1),[X,$]=(0,r.useState)(!1),[K,Q]=(0,r.useState)("active"),[Y,ee]=(0,r.useState)(!0),[es,et]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),en=async()=>{et({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller? This will temporarily interrupt job management.",onConfirm:async()=>{try{$(!0),N(!0),await (0,u.Ce)("restartcontroller"),await er()}catch(e){console.error("Error restarting controller:",e)}finally{$(!1),N(!1)}}})},er=r.useCallback(async()=>{N(!0),t(!0);try{let[e,s]=await Promise.all([E.default.get(u.getManagedJobs,[{allUsers:!0}]),E.default.get(m.getClusters)]),{jobs:t=[],controllerStopped:n=!1}=e||{},r=null==s?void 0:s.find(e=>(0,v.Ym)(e.cluster)),a=r?r.status:"NOT_FOUND",l=!1;"STOPPED"==a&&n&&(l=!0),"LAUNCHING"==a?H(!0):H(!1),j(t),B(l),S(!1)}catch(e){console.error("Error fetching data:",e),j([]),B(!1),S(!1)}finally{N(!1),t(!1)}},[t]);r.useEffect(()=>{a&&(a.current=er)},[a,er]),(0,r.useEffect)(()=>{j([]);let e=!0;er();let t=setInterval(()=>{e&&er()},s);return()=>{e=!1,clearInterval(t)}},[s,er]),(0,r.useEffect)(()=>{I(1)},[K,null==p?void 0:p.length]),(0,r.useEffect)(()=>{q([]),ee(!0)},[K]);let ea=e=>{let s="ascending";f.key===e&&"ascending"===f.direction&&(s="descending"),g({key:e,direction:s})},el=e=>f.key===e?"ascending"===f.direction?" ↑":" ↓":"";r.useMemo(()=>{let e=p||[];return{active:e.filter(e=>R.active.includes(e.status)).length,finished:e.filter(e=>R.finished.includes(e.status)).length}},[p]);let ei=e=>Z.length>0?Z.includes(e):R[K].includes(e),ec=r.useMemo(()=>{let e=l&&l!==M?p.filter(e=>(e.workspace||"default").toLowerCase()===l.toLowerCase()):p;return Z.length>0?e.filter(e=>Z.includes(e.status)):Y?e.filter(e=>R[K].includes(e.status)):[]},[p,K,Z,Y,l]),eo=r.useMemo(()=>f.key?[...ec].sort((e,s)=>e[f.key]<s[f.key]?"ascending"===f.direction?-1:1:e[f.key]>s[f.key]?"ascending"===f.direction?1:-1:0):ec,[ec,f]),ed=Math.ceil(eo.length/O),eh=(L-1)*O,ex=eh+O,eu=eo.slice(eh,ex),em=e=>{if(Z.includes(e)){let s=Z.filter(s=>s!==e);0===s.length?(ee(!0),q([])):(q(s),ee(!1))}else q([...Z,e]),ee(!1)};return(0,r.useEffect)(()=>{V((p||[]).reduce((e,s)=>(e[s.status]=(e[s.status]||0)+1,e),{}))},[p]),(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&&(!p||0===p.length)&&!C&&(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:()=>em(s),className:"px-3 py-1 rounded-full flex items-center space-x-2 ".concat(ei(s)||Z.includes(s)?(0,k.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(ei(s)||Z.includes(s)?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:t})]},s)}),p&&p.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:()=>{Q("active"),q([]),ee(!0)},className:"text-sm font-medium ".concat("active"===K&&Y?"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:()=>{Q("finished"),q([]),ee(!0)},className:"text-sm font-medium ".concat("finished"===K&&Y?"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:()=>ea("id"),children:["ID",el("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("name"),children:["Name",el("name")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("user"),children:["User",el("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("workspace"),children:["Workspace",el("workspace")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("submitted_at"),children:["Submitted",el("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("job_duration"),children:["Duration",el("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("status"),children:["Status",el("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("priority"),children:["Priority",el("priority")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("resources_str"),children:["Requested",el("resources_str")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("infra"),children:["Infra",el("infra")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("cluster"),children:["Resources",el("cluster")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("recoveries"),children:["Recoveries",el("recoveries")]}),(0,n.jsx)(h.ss,{children:"Details"}),(0,n.jsx)(h.ss,{children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:b||C?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:13,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..."})]})})}):eu.length>0?(0,n.jsx)(n.Fragment,{children:eu.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,n.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,n.jsx)(h.pj,{children:_(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,x.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(k.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.priority}),(0,n.jsx)(h.pj,{children:e.requested_resources}),(0,n.jsx)(h.pj,{children:e.infra&&"-"!==e.infra?(0,n.jsx)(x.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,n.jsxs)("span",{children:[(0,n.jsx)(i(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud||e.infra.split("(")[0].trim()}),e.infra.includes("(")&&(0,n.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})}):(0,n.jsx)("span",{children:e.infra||"-"})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(x.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,n.jsx)("span",{children:e.resources_str})})}),(0,n.jsx)(h.pj,{children:e.recoveries}),(0,n.jsx)(h.pj,{children:e.details?(0,n.jsx)(P,{text:e.details,rowId:e.id,expandedRowId:F,setExpandedRowId:U}):"-"}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(D,{jobParent:"/jobs",jobId:e.id,managed:!0})})]}),F===e.id&&(0,n.jsx)(z,{text:e.details,colSpan:13,innerRef:W})]},e.id))}):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:13,className:"text-center py-6",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[G&&(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..."})]})]}),!J&&!G&&(0,n.jsx)("p",{className:"text-gray-500",children:"No active jobs"}),J&&(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:en,className:"text-sky-blue hover:text-sky-blue-bright",disabled:b||X,children:X?(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)(w,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})}),eo&&eo.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:O,onChange:e=>{A(parseInt(e.target.value,10)),I(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:[eh+1," – ",Math.min(ex,eo.length)," of"," ",eo.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{I(e=>Math.max(e-1,1))},disabled:1===L,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:()=>{I(e=>Math.min(e+1,ed))},disabled:L===ed||0===ed,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:es.isOpen,onClose:()=>et({...es,isOpen:!1}),onConfirm:es.onConfirm,title:es.title,message:es.message})]})}function D(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)(x.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)(x.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 A(e){let{clusterName:s,clusterJobData:t,loading:a,refreshClusterJobsOnly:l}=e,[u,m]=(0,r.useState)(null),[p,j]=(0,r.useState)({key:null,direction:"ascending"}),[g,w]=(0,r.useState)(1),[b,N]=(0,r.useState)(10),y=(0,r.useRef)(null),[v,C]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=e=>{u&&y.current&&!y.current.contains(e.target)&&m(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[u]);let S=r.useMemo(()=>t||[],[t]);(0,r.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(v)&&C(t)},[t,v]);let E=r.useMemo(()=>p.key?[...S].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):S,[S,p]),L=e=>{let s="ascending";p.key===e&&"ascending"===p.direction&&(s="descending"),j({key:e,direction:s})},R=e=>p.key===e?"ascending"===p.direction?" ↑":" ↓":"",M=Math.ceil(E.length/b),I=(g-1)*b,O=I+b,A=E.slice(I,O);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"}),(0,n.jsx)("div",{className:"flex items-center",children:l&&(0,n.jsxs)("button",{onClick:l,disabled:a,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center text-sm ml-2",children:[(0,n.jsx)(f.Z,{className:"w-4 h-4 mr-1"}),"Refresh Jobs"]})})]}),(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("id"),children:["ID",R("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("job"),children:["Name",R("job")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("user"),children:["User",R("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("workspace"),children:["Workspace",R("workspace")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("submitted_at"),children:["Submitted",R("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("job_duration"),children:["Duration",R("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("status"),children:["Status",R("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("resources"),children:["Resources",R("resources")]}),(0,n.jsx)(h.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:a?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:9,className:"text-center py-12 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(c.Z,{size:24,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading cluster jobs..."})]})})}):A.length>0?A.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{className:u===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)(P,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:u,setExpandedRowId:m})})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,n.jsx)(h.pj,{children:_(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,x.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(k.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)(D,{jobParent:"/clusters/".concat(s),jobId:e.id,managed:!1})})]}),u===e.id&&(0,n.jsx)(z,{text:e.job||"Unnamed job",colSpan:9,innerRef:y})]},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"})})})]})]}),E&&E.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:b,onChange:e=>{N(parseInt(e.target.value,10)),w(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,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:[I+1," – ",Math.min(O,E.length)," of"," ",E.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{w(e=>Math.max(e-1,1))},disabled:1===g,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:()=>{w(e=>Math.min(e+1,M))},disabled:g===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 z(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 P(e){let{text:s,rowId:t,expandedRowId:a,setExpandedRowId:l}=e,i=s||"",c=i.length>50,o=a===t,d=c?"".concat(i.substring(0,50)):i,h=(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:d}),c&&(0,n.jsx)("button",{ref:h,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(o?null:t)},className:"text-blue-600 hover:text-blue-800 font-medium ml-1 flex-shrink-0","data-button-type":"show-more-less",children:o?"... show less":"... show more"})]})}}}]);
|
@@ -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 L},GV:function(){return W}});var r=t(5893),n=t(7294),l=t(1163),a=t(8799),c=t(6989),i=t(1664),o=t.n(i),d=t(803),h=t(7673),u=t(8764),x=t(3266),p=t(7324),j=t(4545),m=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 w=(0,f.Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),k=(0,f.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 g=t(9470),y=t(9284),N=t(9307),v=t(3001),C=t(8950),b=t(6378),S=t(6856);t(1272);let _="__ALL_WORKSPACES__",M=(e,s)=>{let t="",r="";return e>=0&&(t=e+"m",r=" "),s&&(t+="".concat(r,"(down)")),""===t&&(t="-"),t};function L(){let e=(0,l.useRouter)(),[s,t]=(0,n.useState)(!1),i=n.useRef(null),[d,h]=(0,n.useState)(!1),[u,j]=(0,n.useState)(!1),[f,w]=(0,n.useState)(null),[k,N]=(0,n.useState)(_),[M,L]=(0,n.useState)([]),R=(0,v.X)();return(0,n.useEffect)(()=>{e.isReady&&e.query.workspace&&N(Array.isArray(e.query.workspace)?e.query.workspace[0]:e.query.workspace)},[e.isReady,e.query.workspace]),(0,n.useEffect)(()=>{(async()=>{try{await S.ZP.preloadForPage("clusters");let e=await b.default.get(p.fX),s=Object.keys(e),t=await b.default.get(x.getClusters),r=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],n=new Set(s);r.includes("default")&&n.has("default"),r.forEach(e=>n.add(e)),L(Array.from(n).sort())}catch(e){console.error("Error fetching data for workspace filter:",e),L(["default"])}})()},[]),(0,r.jsxs)(g.A,{highlighted:"clusters",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)(o(),{href:"/clusters",className:"text-sky-blue hover:underline leading-none",children:"Sky Clusters"}),(0,r.jsxs)(C.Ph,{value:k,onValueChange:N,children:[(0,r.jsx)(C.i4,{className:"h-8 w-48 ml-4 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,r.jsx)(C.ki,{placeholder:"Filter by workspace...",children:k===_?"All Workspaces":k})}),(0,r.jsxs)(C.Bw,{children:[(0,r.jsx)(C.Ql,{value:_,children:"All Workspaces"}),M.map(e=>(0,r.jsx)(C.Ql,{value:e,children:e},e))]})]})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[s&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(a.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,r.jsxs)("button",{onClick:()=>{b.default.invalidate(x.getClusters),b.default.invalidate(p.fX),i.current&&i.current()},disabled:s,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(m.Z,{className:"h-4 w-4 mr-1.5"}),!R&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsx)(O,{refreshInterval:c.yc,setLoading:t,refreshDataRef:i,workspaceFilter:k,onOpenSSHModal:e=>{w(e),h(!0)},onOpenVSCodeModal:e=>{w(e),j(!0)}}),(0,r.jsx)(y.Oh,{isOpen:d,onClose:()=>h(!1),cluster:f}),(0,r.jsx)(y._R,{isOpen:u,onClose:()=>j(!1),cluster:f})]})}function O(e){let{refreshInterval:s,setLoading:t,refreshDataRef:l,workspaceFilter:i,onOpenSSHModal:p,onOpenVSCodeModal:m}=e,[f,w]=(0,n.useState)([]),[k,g]=(0,n.useState)({key:null,direction:"ascending"}),[y,v]=(0,n.useState)(!1),[C,S]=(0,n.useState)(!0),[L,O]=(0,n.useState)(1),[R,A]=(0,n.useState)(10),E=n.useCallback(async()=>{t(!0),v(!0),w(await b.default.get(x.getClusters)),t(!1),v(!1),S(!1)},[t]),V=n.useMemo(()=>{let e=f;return i&&i!==_&&(e=f.filter(e=>(e.workspace||"default").toLowerCase()===i.toLowerCase())),(0,j.R0)(e,k.key,k.direction)},[f,k,i]);n.useEffect(()=>{l&&(l.current=E)},[l,E]),(0,n.useEffect)(()=>{w([]);let e=!0;E();let t=setInterval(()=>{e&&E()},s);return()=>{e=!1,clearInterval(t)}},[s,E]),(0,n.useEffect)(()=>{O(1)},[f.length]);let q=e=>{let s="ascending";k.key===e&&"ascending"===k.direction&&(s="descending"),g({key:e,direction:s})},z=e=>k.key===e?"ascending"===k.direction?" ↑":" ↓":"",Z=Math.ceil(V.length/R),I=(L-1)*R,H=I+R,B=V.slice(I,H);return(0,r.jsxs)("div",{children:[(0,r.jsx)(h.Zb,{children:(0,r.jsxs)(u.iA,{children:[(0,r.jsx)(u.xD,{children:(0,r.jsxs)(u.SC,{children:[(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>q("status"),children:["Status",z("status")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>q("cluster"),children:["Cluster",z("cluster")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>q("user"),children:["User",z("user")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>q("workspace"),children:["Workspace",z("workspace")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>q("infra"),children:["Infra",z("infra")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>q("resources_str"),children:["Resources",z("resources_str")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>q("time"),children:["Started",z("time")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>q("autostop"),children:["Autostop",z("autostop")]}),(0,r.jsx)(u.ss,{children:"Actions"})]})}),(0,r.jsx)(u.RM,{children:y&&C?(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):B.length>0?B.map((e,s)=>(0,r.jsxs)(u.SC,{children:[(0,r.jsx)(u.pj,{children:(0,r.jsx)(N.OE,{status:e.status})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(o(),{href:"/clusters/".concat(e.cluster),className:"text-blue-600",children:e.cluster})}),(0,r.jsx)(u.pj,{children:e.user}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(o(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(c.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(o(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud}),e.infra.includes("(")&&(0,r.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(c.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{children:e.resources_str})})}),(0,r.jsx)(u.pj,{children:(0,c.GV)(e.time)}),(0,r.jsx)(u.pj,{children:M(e.autostop,e.to_down)}),(0,r.jsx)(u.pj,{className:"text-left",children:(0,r.jsx)(W,{cluster:e.cluster,status:e.status,onOpenSSHModal:p,onOpenVSCodeModal:m})})]},s)):(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:"No active clusters"})})})]})}),f.length>0&&(0,r.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,r.jsxs)("div",{className:"relative inline-block",children:[(0,r.jsxs)("select",{value:R,onChange:e=>{A(parseInt(e.target.value,10)),O(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:30,children:"30"}),(0,r.jsx)("option",{value:50,children:"50"}),(0,r.jsx)("option",{value:100,children:"100"}),(0,r.jsx)("option",{value:200,children:"200"})]}),(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,r.jsxs)("div",{children:[I+1," – ",Math.min(H,f.length)," of"," ",f.length]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(d.z,{variant:"ghost",size:"icon",onClick:()=>{O(e=>Math.max(e-1,1))},disabled:1===L,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,r.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,r.jsx)(d.z,{variant:"ghost",size:"icon",onClick:()=>{O(e=>Math.min(e+1,Z))},disabled:L===Z||0===Z,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,r.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}let R=(e,s)=>{s&&s(e)},A=(e,s)=>{s?s(e):window.open("ssh://".concat(e))},E=e=>"RUNNING"===e?["connect","VSCode"]:[],V={connect:(0,r.jsx)(w,{className:"w-4 h-4 text-gray-500 inline-block"}),VSCode:(0,r.jsx)(k,{className:"w-4 h-4 text-gray-500 inline-block"})};function W(e){let{withLabel:s=!1,cluster:t,status:n,onOpenSSHModal:l,onOpenVSCodeModal:a}=e,i=E(n),o=(0,v.X)(),d=e=>{switch(e){case"connect":A(t,l);break;case"VSCode":R(t,a);break;default:return}};return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"flex items-center space-x-4",children:Object.entries(V).map(e=>{let t,n,[l,a]=e;switch(l){case"connect":t="Connect",n="Connect with SSH";break;case"VSCode":t="VSCode",n="Open in VS Code"}return(s||(t=""),i.includes(l))?(0,r.jsx)(c.WH,{content:n,className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:()=>d(l),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[a,!o&&(0,r.jsx)("span",{className:"ml-1.5",children:t})]})},l):(0,r.jsx)(c.WH,{content:n,className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("span",{className:"opacity-30 flex items-center cursor-not-allowed text-sm",title:l,children:[a,!o&&(0,r.jsx)("span",{className:"ml-1.5",children:t})]})},l)})})})}}}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[682],{3626:function(e,s,t){t.d(s,{Z:function(){return a}});/**
|
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 a=(0,t(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},8682:function(e,s,t){t.d(s,{fx:function(){return v}});var a=t(5893),l=t(7294),r=t(8799),n=t(9470),d=t(3626),c=t(3001),i=t(2045),o=t(3266),x=t(8969),m=t(6378),h=t(6856),u=t(1214),g=t(1163),f=t(1664),p=t.n(f),j=t(6989);let N=u.nb.REFRESH_INTERVAL,b=u.MO.NAME_TRUNCATE_LENGTH;function y(e){let{title:s,isLoading:t,isDataLoaded:l,contexts:n,gpus:d,groupedPerContextGPUs:c,groupedPerNodeGPUs:i,handleContextClick:o,contextStats:x={},isSSH:m=!1}=e,h=n||[];return t||!l?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:s}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(r.Z,{size:24,className:"mr-3"}),(0,a.jsxs)("span",{className:"text-gray-500",children:["Loading ",s,"..."]})]})]})}):l&&0===h.length?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:s}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["No ",s," found or ",s," is not configured."]})]})}):l&&h.length>0?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:s}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[h.length," ",1===h.length?m?"pool":"context":m?"pools":"contexts"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:m?"Node Pool":"Context"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Jobs"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Nodes"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"GPU Types"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"#GPUs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(h.length>5?"max-h-[250px] overflow-y-auto block":""),children:h.map(e=>{let s=c[e]||[],t=i[e]||[],l=s.reduce((e,s)=>e+(s.gpu_total||0),0),r=x[m?"ssh/".concat(e.replace(/^ssh-/,"")):"kubernetes/".concat(e)]||{clusters:0,jobs:0},n=Object.keys(s.reduce((e,s)=>(e[s.gpu_name]=(e[s.gpu_name]||0)+(s.gpu_total||0),e),{})).join(", "),d=m?e.replace(/^ssh-/,""):e;return(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3",children:(0,a.jsx)(j.Md,{content:d,className:"text-sm text-muted-foreground",children:(0,a.jsx)("span",{className:"text-blue-600 hover:underline cursor-pointer",onClick:()=>o(e),children:d.length>b?"".concat(d.substring(0,Math.floor((b-3)/2)),"...").concat(d.substring(d.length-Math.ceil((b-3)/2))):d})})}),(0,a.jsx)("td",{className:"p-3",children:r.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:r.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:r.jobs>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:r.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:(t||[]).length}),(0,a.jsx)("td",{className:"p-3",children:n||"-"}),(0,a.jsx)("td",{className:"p-3",children:l})]},e)})})]})})}),d&&d.length>0&&(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4 whitespace-nowrap",children:["GPU",(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-green-100 text-green-800 rounded-full text-xs font-medium whitespace-nowrap",children:[d.reduce((e,s)=>e+s.gpu_free,0)," ","of"," ",d.reduce((e,s)=>e+s.gpu_total,0)," ","free"]})]}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"Requestable"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/2",children:(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsx)("span",{children:"Utilization"})})})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200 ".concat(d.length>5?"max-h-[250px] overflow-y-auto block":""),children:d.map(e=>{let s=e.gpu_total-e.gpu_free,t=e.gpu_total>0?e.gpu_free/e.gpu_total*100:0,l=e.gpu_total>0?s/e.gpu_total*100:0,r=c?Object.values(c).flat().filter(s=>s.gpu_name===e.gpu_name&&(m?s.context.startsWith("ssh-"):!s.context.startsWith("ssh-"))).map(e=>e.gpu_requestable_qty_per_node).filter((e,s,t)=>t.indexOf(e)===s).join(", "):"-";return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"p-3 font-medium w-24 whitespace-nowrap",children:e.gpu_name}),(0,a.jsxs)("td",{className:"p-3 text-xs text-gray-600",children:[r||"-"," / node"]}),(0,a.jsx)("td",{className:"p-3 w-2/3",children:(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsxs)("div",{className:"flex-1 bg-gray-100 rounded-md h-5 flex overflow-hidden shadow-sm min-w-[100px] w-full",children:[l>0&&(0,a.jsx)("div",{style:{width:"".concat(l,"%")},className:"bg-yellow-500 h-full flex items-center justify-center text-white text-xs font-medium",children:l>15&&"".concat(s," used")}),t>0&&(0,a.jsx)("div",{style:{width:"".concat(t,"%")},className:"bg-green-700 h-full flex items-center justify-center text-white text-xs font-medium",children:t>15&&"".concat(e.gpu_free," free")})]})})})]},e.gpu_name)})})]})})})]})]})}):null}function w(e){let{contextName:s,gpusInContext:t,nodesInContext:l}=e;return s.startsWith("ssh-"),(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm h-full",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4",children:"Available GPUs"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:t.map(e=>{let s=e.gpu_total-e.gpu_free,t=e.gpu_total>0?e.gpu_free/e.gpu_total*100:0,l=e.gpu_total>0?s/e.gpu_total*100:0;return(0,a.jsxs)("div",{className:"p-3 bg-gray-50 rounded-md border border-gray-200 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-1.5 flex-wrap",children:[(0,a.jsxs)("div",{className:"font-medium text-gray-800 text-sm",children:[e.gpu_name,(0,a.jsxs)("span",{className:"text-xs text-gray-500 ml-2",children:["(Requestable: ",e.gpu_requestable_qty_per_node," / node)"]})]}),(0,a.jsxs)("span",{className:"text-xs font-medium",children:[e.gpu_free," free / ",e.gpu_total," total"]})]}),(0,a.jsxs)("div",{className:"w-full bg-gray-100 rounded-md h-4 flex overflow-hidden shadow-sm",children:[l>0&&(0,a.jsx)("div",{style:{width:"".concat(l,"%")},className:"bg-yellow-500 h-full flex items-center justify-center text-white text-xs",children:l>15&&"".concat(s," used")}),t>0&&(0,a.jsx)("div",{style:{width:"".concat(t,"%")},className:"bg-green-700 h-full flex items-center justify-center text-white text-xs",children:t>15&&"".concat(e.gpu_free," free")})]})]},e.gpu_name)})}),l&&l.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4",children:"Nodes"}),(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-100",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"Node"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"GPU"}),(0,a.jsx)("th",{className:"p-3 text-right font-medium text-gray-600",children:"Availability"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:l.map((e,s)=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.node_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.gpu_name}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-right text-gray-700",children:"".concat(e.gpu_free," of ").concat(e.gpu_total," free")})]},"".concat(e.node_name,"-").concat(s)))})]})})]})]})})})}function v(){let[e,s]=(0,l.useState)(!0),[t,u]=(0,l.useState)(!0),[f,j]=(0,l.useState)(!0),b=l.useRef(null),v=(0,c.X)(),[_,C]=(0,l.useState)(!1),[S,k]=(0,l.useState)(!1),P=(0,g.useRouter)(),[L,U]=(0,l.useState)([]),[E,I]=(0,l.useState)([]),[M,R]=(0,l.useState)([]),[G,q]=(0,l.useState)([]),[A,Z]=(0,l.useState)([]),[W,z]=(0,l.useState)(0),[H,D]=(0,l.useState)(0),[F,T]=(0,l.useState)({}),[O,J]=(0,l.useState)(null),K=l.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showLoadingIndicators:!0};e.showLoadingIndicators&&(s(!0),u(!0));try{let e=await m.default.get(i.l4),{gpuData:s,cloudData:t}=e||{};if(s){let{allContextNames:e,allGPUs:t,perContextGPUs:a,perNodeGPUs:l,contextStats:r}=s;U(e||[]),I(t||[]),R(a||[]),q(l||[]),T(r||{}),C(!0)}else e&&null===e.gpuData?(U([]),I([]),R([]),q([]),T({}),C(!0)):e||console.log("No infra data received from cache");t?(Z(t.clouds||[]),z(t.totalClouds||0),D(t.enabledClouds||0),k(!0)):e&&null===e.cloudData?(Z([]),z(0),D(0),k(!0)):e||console.log("No cloud data received from cache")}catch(e){console.error("Error in fetchData:",e),U([]),I([]),R([]),q([]),T({}),Z([]),z(0),D(0),C(!0),k(!0)}finally{e.showLoadingIndicators&&(s(!1),u(!1)),f&&e.showLoadingIndicators&&j(!1)}},[f]);(0,l.useEffect)(()=>{b.current=K},[K]),(0,l.useEffect)(()=>{(async()=>{await h.ZP.preloadForPage("infra"),K({showLoadingIndicators:!0})})()},[K]),(0,l.useEffect)(()=>{let e=!0,s=setInterval(()=>{e&&b.current&&b.current({showLoadingIndicators:!1})},N);return()=>{e=!1,clearInterval(s)}},[]),(0,l.useEffect)(()=>()=>{C(!1),k(!1),j(!0)},[]),(E||[]).length,(E||[]).reduce((e,s)=>e+s.gpu_total,0),(E||[]).reduce((e,s)=>e+s.gpu_free,0);let V=l.useMemo(()=>M?M.reduce((e,s)=>{let{context:t}=s;return e[t]||(e[t]=[]),e[t].push(s),e},{}):{},[M]),X=l.useMemo(()=>L&&Array.isArray(L)?L.filter(e=>e.startsWith("ssh-")):[],[L]),B=l.useMemo(()=>L&&Array.isArray(L)?L.filter(e=>!e.startsWith("ssh-")):[],[L]),Q=l.useMemo(()=>{if(!M||!E)return[];let e=new Set;return M.forEach(s=>{s.context.startsWith("ssh-")&&e.add(s.gpu_name)}),E.filter(s=>e.has(s.gpu_name))},[E,M]),Y=l.useMemo(()=>{if(!M||!E)return[];let e=new Set;return M.forEach(s=>{s.context.startsWith("ssh-")||e.add(s.gpu_name)}),E.filter(s=>e.has(s.gpu_name))},[E,M]),$=l.useMemo(()=>G?G.reduce((e,s)=>{let{context:t}=s;return e[t]||(e[t]=[]),e[t].push(s),e},{}):{},[G]);(0,l.useEffect)(()=>{P.isReady&&P.query.context&&J(decodeURIComponent(Array.isArray(P.query.context)?P.query.context[0]:P.query.context))},[P.isReady,P.query.context]);let ee=e=>{J(e),P.push("/infra/".concat(encodeURIComponent(e)))},es=e||t,et=_&&S&&!f;return(0,a.jsxs)(n.A,{highlighted:"infra",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsxs)("div",{className:"text-base flex items-center",children:[(0,a.jsx)(p(),{href:"/infra",className:"text-sky-blue hover:underline ".concat(O?"":"cursor-default"),children:"Infrastructure"}),O&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),O.startsWith("ssh-")?(0,a.jsx)(p(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"SSH Node Pool"}):(0,a.jsx)(p(),{href:"/infra",className:"text-sky-blue hover:underline cursor-pointer",children:"Kubernetes"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)("span",{className:"text-sky-blue",children:O.startsWith("ssh-")?O.replace(/^ssh-/,""):O})]})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[es&&(0,a.jsxs)("div",{className:"flex items-center mr-2",children:[(0,a.jsx)(r.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,a.jsxs)("button",{onClick:()=>{m.default.invalidate(o.getClusters),m.default.invalidate(x.getManagedJobs,[{allUsers:!0}]),m.default.invalidate(i.l4),b.current&&b.current({showLoadingIndicators:!0})},disabled:es,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,a.jsx)(d.Z,{className:"h-4 w-4 mr-1.5"}),!v&&"Refresh"]})]})]}),et?O?e&&!_?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]}):(s=>{let t=V[s]||[],l=$[s]||[];return e&&!_?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading Context..."})]}):(0,a.jsx)(w,{contextName:s,gpusInContext:t,nodesInContext:l})})(O):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y,{title:"SSH Node Pool",isLoading:e,isDataLoaded:_,contexts:X,gpus:Q,groupedPerContextGPUs:V,groupedPerNodeGPUs:$,handleContextClick:ee,contextStats:F,isSSH:!0}),(0,a.jsx)(y,{title:"Kubernetes",isLoading:e,isDataLoaded:_,contexts:B,gpus:Y,groupedPerContextGPUs:V,groupedPerNodeGPUs:$,handleContextClick:ee,contextStats:F,isSSH:!1}),t||!S?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:"Cloud"}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(r.Z,{size:24,className:"mr-3"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading Cloud..."})]})]})}):(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Cloud"}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[H," of ",W," enabled"]})]}),A&&0!==A.length?(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm bg-white",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-32",children:"Cloud"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Jobs"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:A.map(e=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 font-medium text-gray-700",children:e.name}),(0,a.jsx)("td",{className:"p-3",children:e.clusters>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:e.clusters}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,a.jsx)("td",{className:"p-3",children:e.jobs>0?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:e.jobs}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})})]},e.name))})]})}):(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"No enabled clouds available."})]})})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-32",children:[(0,a.jsx)(r.Z,{size:32,className:"mb-4"}),(0,a.jsx)("span",{className:"text-gray-500 text-lg",children:"Loading infrastructure data..."})]})]})}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[856],{3266:function(e,t,r){r.d(t,{QL:function(){return d},Sl:function(){return u},getClusters:function(){return c}});var a=r(7294),o=r(5821),s=r(3225),n=r(6378);let l={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function c(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=await fetch("".concat(s.f4,"/status"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cluster_names:e,all_users:!0})}),r=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("X-Request-ID"),a=await fetch("".concat(s.f4,"/api/get?request_id=").concat(r)),o=await a.json();return(o.return_value?JSON.parse(o.return_value):[]).map(e=>{let t="",r=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let r=Math.floor((t-3)/2),a=r+(t-3)%2;return 0===r?e.substring(0,a)+"...":e.substring(0,a)+"..."+e.substring(e.length-r)}(t,25)),{status:l[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:r?"".concat(e.cloud," (").concat(r,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,autostop:e.autostop,to_down:e.to_down,jobs:[],command:e.last_creation_command||e.last_use,task_yaml:e.last_creation_yaml||"{}",events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}})}catch(e){return console.error("Error fetching clusters:",e),[]}}async function u(e){let{clusterName:t,jobId:r,onNewLog:a,workspace:n}=e;try{let e=(await fetch("".concat(s.f4,"/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({follow:!1,cluster_name:t,job_id:r,override_skypilot_config:{active_workspace:n||"default"}})})).body.getReader();for(;;){let{done:t,value:r}=await e.read();if(t)break;let o=new TextDecoder().decode(r);a(o)}}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,o.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function i(e){let{clusterName:t,workspace:r}=e;try{let e=await fetch("".concat(s.f4,"/queue"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:r}})}),a=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),o=await fetch("".concat(s.f4,"/api/get?request_id=").concat(a)),n=await o.json();return JSON.parse(n.return_value).map(e=>{let a=e.end_at?e.end_at:Date.now()/1e3,o=0,s=0;return e.submitted_at&&(o=a-e.submitted_at),e.start_at&&(s=a-e.start_at),{id:e.job_id,status:e.status,job:e.job_name,user:e.username,gpus:e.accelerators||{},submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,resources:e.resources,cluster:t,total_duration:o,job_duration:s,infra:"",logs:"",workspace:r||"default"}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function d(e){let{cluster:t,job:r=null}=e,[o,s]=(0,a.useState)(null),[l,u]=(0,a.useState)(null),[d,g]=(0,a.useState)(!0),[f,p]=(0,a.useState)(!0),h=(0,a.useCallback)(async()=>{if(t)try{g(!0);let e=await n.default.get(c,[{clusterNames:[t]}]);return s(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{g(!1)}return null},[t]),_=(0,a.useCallback)(async e=>{if(t)try{p(!0);let r=await n.default.get(i,[{clusterName:t,workspace:e||"default"}]);u(r)}catch(e){console.error("Error fetching cluster job data:",e)}finally{p(!1)}},[t]),b=(0,a.useCallback)(async()=>{n.default.invalidate(c,[{clusterNames:[t]}]);let e=await h();e&&(n.default.invalidate(i,[{clusterName:t,workspace:e.workspace||"default"}]),await _(e.workspace))},[h,_,t]),m=(0,a.useCallback)(async()=>{o&&(n.default.invalidate(i,[{clusterName:t,workspace:o.workspace||"default"}]),await _(o.workspace))},[_,o,t]);return(0,a.useEffect)(()=>{(async()=>{let e=await h();e&&_(e.workspace)})()},[t,r,h,_]),{clusterData:o,clusterJobData:l,loading:d,clusterDetailsLoading:d,clusterJobsLoading:f,refreshData:b,refreshClusterJobsOnly:m}}},2045:function(e,t,r){r.d(t,{l4:function(){return s}});var a=r(3225);async function o(e,t){try{let r=[];try{let e=await fetch("".concat(a.f4,"/enabled_clouds"),{method:"GET",headers:{"Content-Type":"application/json"}}),t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),o=await fetch("".concat(a.f4,"/api/get?request_id=").concat(t)),s=await o.json();r=s.return_value?JSON.parse(s.return_value):[],console.log("Enabled clouds:",r)}catch(e){console.error("Error fetching enabled clouds:",e),r=[]}let o={};a.$m.forEach(e=>{let t=r.includes(e.toLowerCase());o[e]={name:e,clusters:0,jobs:0,enabled:t}}),e.forEach(e=>{if(e.cloud){let t=e.cloud;o[t]&&(o[t].clusters+=1,o[t].enabled=!0)}}),t.forEach(e=>{if(e.cloud){let t=e.cloud;o[t]&&(o[t].jobs+=1,o[t].enabled=!0)}});let s=a.$m.length,n=Object.values(o).filter(e=>e.enabled).length;return{clouds:Object.values(o).filter(e=>e.enabled).sort((e,t)=>t.clusters-e.clusters||t.jobs-e.jobs),totalClouds:s,enabledClouds:n}}catch(e){return console.error("Error fetching cloud infrastructure:",e),{clouds:[],totalClouds:a.$m.length,enabledClouds:0}}}async function s(){let{getClusters:e}=await Promise.resolve().then(r.bind(r,3266)),{getManagedJobs:t}=await Promise.resolve().then(r.bind(r,8969)),a=(await Promise.resolve().then(r.bind(r,6378))).default,[s,l]=await Promise.all([a.get(e),a.get(t,[{allUsers:!0}])]),c=s||[],u=(null==l?void 0:l.jobs)||[],[i,d]=await Promise.all([n(c,u),o(c,u)]);return{gpuData:i,cloudData:d}}async function n(e,t){return await d({clusters:e||[],jobs:t||[]})}async function l(){try{let e=await fetch("".concat(a.f4,"/realtime_kubernetes_gpu_availability"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:null,name_filter:null,quantity_filter:null})});if(!e.ok)return console.error("Error fetching Kubernetes context GPUs (in getKubernetesContextGPUs): ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for Kubernetes GPU availability (in getKubernetesContextGPUs)"),[];let r=await fetch("".concat(a.f4,"/api/get?request_id=").concat(t)),o=await r.text();if(500===r.status){try{let e=JSON.parse(o);if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("[infra.jsx] getKubernetesContextGPUs: Server error detail:",t.message)}catch(t){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing server error JSON:",t,"Original error text:",e.detail.error)}}catch(e){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing 500 error response JSON:",e,"Raw text was:",o)}return[]}let s=JSON.parse(o);return s.return_value?JSON.parse(s.return_value):[]}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesContextGPUs:",e),[]}}async function c(){try{let e=await fetch("".concat(a.f4,"/all_contexts"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)return console.error("Error fetching all contexts: ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for /all_contexts"),[];let r=await fetch("".concat(a.f4,"/api/get?request_id=").concat(t)),o=await r.json();return o.return_value?JSON.parse(o.return_value):[]}catch(e){return console.error("[infra.jsx] Error in getAllContexts:",e),[]}}async function u(e){try{let t=await fetch("".concat(a.f4,"/kubernetes_node_info"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:e})}),r=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("x-request-id"),o=await fetch("".concat(a.f4,"/api/get?request_id=").concat(r));if(500===o.status){try{let e=await o.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Kubernetes per node GPUs:",t.message)}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{}}let s=await o.json();return(s.return_value?JSON.parse(s.return_value):{}).node_info_dict||{}}catch(t){return console.error("[infra.jsx] Error in getKubernetesPerNodeGPUs for context",e,":",t),{}}}async function i(e){try{let t=e.clusters,r=e.jobs,a={};return t.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(a[t]||(a[t]={clusters:0,jobs:0}),a[t].clusters+=1)}),r.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(a[t]||(a[t]={clusters:0,jobs:0}),a[t].jobs+=1)}),a}catch(e){return console.error("=== Error in getContextClustersAndJobs ===",e),{}}}async function d(e){try{let s=await c();if(!s||0===s.length)return console.log("No contexts found from /all_contexts endpoint."),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}};let n=await i(e),d=await l(),g=new Map;d&&d.forEach(e=>{g.set(e[0],e[1])});let f={},p={},h={};for(let e of s){p[e]||(p[e]=[]);let s=g.get(e);if(s&&s.length>0)for(let t of s){let r=t[0],a=t[1].join(", "),o=t[2],s=t[3];r in f?(f[r].gpu_total+=o,f[r].gpu_free+=s):f[r]={gpu_total:o,gpu_free:s,gpu_name:r},p[e].push({gpu_name:r,gpu_requestable_qty_per_node:a,gpu_total:o,gpu_free:s,context:e})}let n=await u(e);if(n&&Object.keys(n).length>0)for(let s in n){var t,r,a,o;let l=n[s],c=l.accelerator_type||"-",u=null!==(a=null===(t=l.total)||void 0===t?void 0:t.accelerator_count)&&void 0!==a?a:0,i=null!==(o=null===(r=l.free)||void 0===r?void 0:r.accelerators_available)&&void 0!==o?o:0;h["".concat(e,"/").concat(s)]={node_name:l.name,gpu_name:c,gpu_total:u,gpu_free:i,context:e},"-"===c||p[e].some(e=>e.gpu_name===c)||(c in f||(f[c]={gpu_total:0,gpu_free:0,gpu_name:c}),p[e].find(e=>e.gpu_name===c)||p[e].push({gpu_name:c,gpu_requestable_qty_per_node:"-",gpu_total:0,gpu_free:0,context:e}))}0===p[e].length&&n&&Object.keys(n).length}return{allContextNames:s.sort(),allGPUs:Object.values(f).sort((e,t)=>e.gpu_name.localeCompare(t.gpu_name)),perContextGPUs:Object.values(p).flat().sort((e,t)=>e.context.localeCompare(t.context)||e.gpu_name.localeCompare(t.gpu_name)),perNodeGPUs:Object.values(h).sort((e,t)=>e.context.localeCompare(t.context)||e.node_name.localeCompare(t.node_name)||e.gpu_name.localeCompare(t.gpu_name)),contextStats:n}}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesGPUs:",e),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}}}}r(3266),r(8969)},3081:function(e,t,r){r.d(t,{R:function(){return c},i:function(){return u}});var a=r(3225),o=r(3266),s=r(8969);let n=e=>e&&e.includes("@")?e.split("@")[0]:e||"N/A",l=e=>e&&e.includes("@")?e:"-";async function c(){try{let e=await fetch("".concat(a.f4,"/users"));if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return(await e.json()).map(e=>({userId:e.id,username:e.name}))||[]}catch(e){return console.error("Failed to fetch users:",e),[]}}async function u(){let[e,t,r]=await Promise.all([c(),(0,o.getClusters)(),(0,s.getManagedJobs)()]),a=r.jobs||[];return(e||[]).map(e=>{let r=(t||[]).filter(t=>t.user_hash===e.userId),o=(a||[]).filter(t=>t.user_hash===e.userId);return{...e,usernameDisplay:n(e.username),fullEmail:l(e.username),clusterCount:r.length,jobCount:o.length}})}},6856:function(e,t,r){var a=r(6378),o=r(3266),s=r(8969),n=r(7324),l=r(3081),c=r(2045);let u={base:{getClusters:{fn:o.getClusters,args:[]},getManagedJobs:{fn:s.getManagedJobs,args:[{allUsers:!0}]},getWorkspaces:{fn:n.fX,args:[]},getUsers:{fn:l.R,args:[]},getUsersWithCounts:{fn:l.i,args:[]},getInfraData:{fn:c.l4,args:[]}},dynamic:{getEnabledClouds:{fn:n.yz,requiresWorkspaces:!0}},pages:{clusters:["getClusters","getWorkspaces"],jobs:["getManagedJobs","getClusters","getWorkspaces"],infra:["getInfraData"],workspaces:["getWorkspaces","getClusters","getManagedJobs","getEnabledClouds"],users:["getUsersWithCounts"]}};class i{async preloadForPage(e,t){let{backgroundPreload:r=!0,force:a=!1}=t||{};if(!u.pages[e]){console.warn("Unknown page: ".concat(e));return}console.log("[CachePreloader] Preloading cache for page: ".concat(e));try{await this._loadPageData(e,a),r&&this._backgroundPreloadOtherPages(e)}catch(t){console.error("[CachePreloader] Error preloading for page ".concat(e,":"),t)}}async _loadPageData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=u.pages[e],o=[];for(let e of r)if(u.base[e]){let{fn:r,args:s}=u.base[e];t&&a.default.invalidate(r,s),o.push(a.default.get(r,s))}else"getEnabledClouds"===e&&o.push(this._loadEnabledCloudsForAllWorkspaces(t));await Promise.allSettled(o),console.log("[CachePreloader] Loaded data for page: ".concat(e))}async _loadEnabledCloudsForAllWorkspaces(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&a.default.invalidate(n.fX);let t=await a.default.get(n.fX),r=Object.keys(t||{}).map(t=>(e&&a.default.invalidate(n.yz,[t]),a.default.get(n.yz,[t])));await Promise.allSettled(r)}catch(e){console.error("[CachePreloader] Error loading enabled clouds:",e)}}_backgroundPreloadOtherPages(e){if(this.isPreloading)return;this.isPreloading=!0;let t=Object.keys(u.pages).filter(t=>t!==e);console.log("[CachePreloader] Background preloading pages: ".concat(t.join(", "))),Promise.allSettled(t.map(async e=>{try{await this._loadPageData(e,!1),console.log("[CachePreloader] Background loaded: ".concat(e))}catch(t){console.error("[CachePreloader] Background load failed for ".concat(e,":"),t)}})).then(()=>{this.isPreloading=!1,console.log("[CachePreloader] Background preloading complete")})}async preloadBaseFunctions(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];console.log("[CachePreloader] Preloading all base functions");let t=Object.entries(u.base).map(t=>{let[r,{fn:o,args:s}]=t;return e&&a.default.invalidate(o,s),a.default.get(o,s).catch(e=>{console.error("[CachePreloader] Failed to preload ".concat(r,":"),e)})});await Promise.allSettled(t),console.log("[CachePreloader] Base functions preloaded")}getCacheStats(){return{...a.default.getStats(),isPreloading:this.isPreloading}}clearCache(){a.default.clear(),this.isPreloading=!1,this.preloadPromises.clear(),console.log("[CachePreloader] Cache cleared")}constructor(){this.isPreloading=!1,this.preloadPromises=new Map}}let d=new i;t.ZP=d}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[969],{8969:function(e,t,r){r.d(t,{Ce:function(){return d},NJ:function(){return l},UA:function(){return i},getManagedJobs:function(){return c}});var o=r(7294),a=r(5821),n=r(3225),s=r(6378);async function c(){let{allUsers:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=(await fetch("".concat(n.f4,"/jobs/queue"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({all_users:e})})).headers.get("X-Skypilot-Request-ID"),r=await fetch("".concat(n.f4,"/api/get?request_id=").concat(t));if(500===r.status){try{let e=await r.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t.type&&t.type===n.iW)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 o=await r.json();return{jobs:(o.return_value?JSON.parse(o.return_value):[]).map(e=>{let t=[];e.submitted_at&&t.push({time:new Date(1e3*e.submitted_at),event:"Job submitted."}),e.start_at&&t.push({time:new Date(1e3*e.start_at),event:"Job started."}),e.end_at&&("CANCELLING"==e.status||"CANCELLED"==e.status?t.push({time:new Date(1e3*e.end_at),event:"Job cancelled."}):t.push({time:new Date(1e3*e.end_at),event:"Job completed."})),e.last_recovered_at&&e.last_recovered_at!=e.start_at&&t.push({time:new Date(1e3*e.last_recovered_at),event:"Job recovered."});let r=(e.end_at?e.end_at:Date.now()/1e3)-e.submitted_at,o=e.cloud,a=e.cluster_resources;if(!o){if(e.cluster_resources&&"-"!==e.cluster_resources)try{o=e.cluster_resources.split("(")[0].split("x").pop().trim(),a=e.cluster_resources.replace("".concat(o,"("),"(").replace("x ","x")}catch(e){o="Unknown"}else o="Unknown"}let n="",s=n=e.zone?e.zone:e.region;n&&n.length>15&&(n=n.substring(0,15)+"...");let c=o+" ("+n+")";"-"===n&&(c=o);let i=o+" ("+s+")";return"-"===s&&(i=o),{id:e.job_id,task:e.task_name,name:e.job_name,job_duration:e.job_duration,total_duration:r,workspace:e.workspace,status:e.status,priority:e.priority,requested_resources:e.resources,resources_str:a,resources_str_full:e.cluster_resources_full||a,cloud:o,region:e.region,infra:c,full_infra:i,recoveries:e.recovery_count,details:e.details||e.failure_reason,user:e.user_name,user_hash:e.user_hash,submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,events:t,dag_yaml:e.dag_yaml,entrypoint:e.entrypoint}}),controllerStopped:!1}}catch(e){return console.error("Error fetching managed job data:",e),{jobs:[],controllerStopped:!1}}}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,[r,a]=(0,o.useState)(null),[n,i]=(0,o.useState)(!0);return(0,o.useEffect)(()=>{(async function(){if(e)try{var t;i(!0);let r=await s.default.get(c,[{allUsers:!0}]),o=null==r?void 0:null===(t=r.jobs)||void 0===t?void 0:t.find(t=>String(t.id)===String(e));o?a({jobs:[o],controllerStopped:r.controllerStopped||!1}):a({jobs:[],controllerStopped:r.controllerStopped||!1})}catch(e){console.error("Error fetching single managed job data:",e),a({jobs:[],controllerStopped:!1})}finally{i(!1)}})()},[e,t]),{jobData:r,loading:n}}async function l(e){let t,{jobId:r,controller:o=!1,signal:s,onNewLog:c}=e,i=Date.now(),l=new Promise(e=>{let r=()=>{let o=Date.now()-i;o>=3e4?e({timeout:!0}):t=setTimeout(r,3e4-o)};t=setTimeout(r,3e4)}),d=(async()=>{try{let e=(await fetch("".concat(n.f4,"/jobs/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({controller:o,follow:!1,job_id:r,tail:1e3}),...s?{signal:s}:{}})).body.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;i=Date.now();let o=new TextDecoder().decode(r);c(o)}}finally{e.cancel(),t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),u=await Promise.race([d,l]);if(t&&clearTimeout(t),u.timeout){(0,a.C)("Log request for job ".concat(r," timed out after ").concat(30,"s of inactivity"),"warning");return}}async function d(e,t,r){let o="",s="",c="",i={};if("restartcontroller"===e)o="Restarting",s="restarted",c="jobs/queue",i={all_users:!0,refresh:!0},t="controller";else throw Error("Invalid action: ".concat(e));(0,a.C)("".concat(o," job ").concat(t,"..."),"info");try{try{let e=(await fetch("".concat(n.f4,"/").concat(c),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})).headers.get("X-Skypilot-Request-ID"),l=await fetch("".concat(n.f4,"/api/get?request_id=").concat(e));if(200===l.status)(0,a.C)("Job ".concat(t," ").concat(s," successfully."),"success");else if(500===l.status)try{let e=await l.json();if(e.detail&&e.detail.error)try{let s=JSON.parse(e.detail.error);s.type&&s.type===n.Bo?(0,a.C)("".concat(o," job ").concat(t," is not supported!"),"error",1e4):s.type&&s.type===n.mF?(0,a.C)("Cluster ".concat(r," does not exist."),"error"):s.type&&s.type===n.iW?(0,a.C)("Cluster ".concat(r," is not up."),"error"):(0,a.C)("".concat(o," job ").concat(t," failed: ").concat(s.type),"error")}catch(r){(0,a.C)("".concat(o," job ").concat(t," failed: ").concat(e.detail.error),"error")}else(0,a.C)("".concat(o," job ").concat(t," failed with no details."),"error")}catch(e){(0,a.C)("".concat(o," job ").concat(t," failed with parse error."),"error")}else(0,a.C)("".concat(o," job ").concat(t," failed with status ").concat(l.status,"."),"error")}catch(e){console.error("Fetch error:",e),(0,a.C)("Network error ".concat(o," job ").concat(t,": ").concat(e.message),"error")}}catch(e){console.error("Error in handleStop:",e),(0,a.C)("Critical error ".concat(o," job ").concat(t,": ").concat(e.message),"error")}}},5821:function(e,t,r){r.d(t,{C:function(){return o}});function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,o=document.getElementById("toast-container");o||((o=document.createElement("div")).id="toast-container",o.className="fixed top-0 right-0 p-4 z-[9999] flex flex-col items-end space-y-2",document.body.appendChild(o));let a=document.createElement("div");switch(a.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":a.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":a.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":a.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:a.className+=" bg-blue-100 border-blue-500 text-blue-800"}return a.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 '),o.appendChild(a),a.querySelector("button").addEventListener("click",()=>{o.removeChild(a)}),setTimeout(()=>{o.contains(a)&&o.removeChild(a)},r),a}},6378:function(e,t,r){r.r(t),r.d(t,{DashboardCache:function(){return a},dashboardCache:function(){return n}});let o=r(1214).ej.DEFAULT_TTL;class a{async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.ttl||o,n=!1!==r.refreshOnAccess,s=this._generateKey(e,t),c=e.name||"anonymous",i=this.cache.get(s),l=Date.now();if(i&&l-i.lastUpdated<a){let r=Math.round((l-i.lastUpdated)/1e3);return this._debug("Cache HIT for ".concat(c," (age: ").concat(r,"s, TTL: ").concat(Math.round(a/1e3),"s)")),n&&(this.cache.set(s,{data:i.data,lastUpdated:l}),this._debug("Cache TTL refreshed for ".concat(c))),this.backgroundJobs.has(s)||this._refreshInBackground(e,t,s),i.data}try{let r=await e(...t);return this.cache.set(s,{data:r,lastUpdated:l}),r}catch(e){if(i)return console.warn("Failed to fetch fresh data for ".concat(s,", returning stale data:"),e),i.data;throw e}}invalidate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=this._generateKey(e,t);this.cache.delete(r),this.backgroundJobs.delete(r)}invalidateFunction(e){let t=e.name||"anonymous",r=[];for(let e of this.cache.keys())e.startsWith("".concat(t,"_"))&&r.push(e);r.forEach(e=>{this.cache.delete(e),this.backgroundJobs.delete(e)})}clear(){this.cache.clear(),this.backgroundJobs.clear()}getStats(){return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,keys:Array.from(this.cache.keys())}}getDetailedStats(){let e=Date.now(),t=[];for(let[r,o]of this.cache.entries()){let a=e-o.lastUpdated;t.push({key:r,age:Math.round(a/1e3),lastUpdated:new Date(o.lastUpdated).toISOString(),hasBackgroundJob:this.backgroundJobs.has(r)})}return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,entries:t.sort((e,t)=>e.age-t.age)}}setDebugMode(e){this.debugMode=e}_debug(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];this.debugMode&&console.log("[DashboardCache] ".concat(e),...r)}_refreshInBackground(e,t,r){this.backgroundJobs.set(r,!0),e(...t).then(e=>{this.cache.set(r,{data:e,lastUpdated:Date.now()})}).catch(e=>{console.warn("Background refresh failed for ".concat(r,":"),e)}).finally(()=>{this.backgroundJobs.delete(r)})}_generateKey(e,t){let r=e.name||"anonymous",o=t.length>0?JSON.stringify(t):"";return"".concat(r,"_").concat(o)}constructor(){this.cache=new Map,this.backgroundJobs=new Map,this.debugMode=!1}}let n=new a;t.default=n}}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[826],{4966:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters/[cluster]/[job]",function(){return s(190)}])},3626:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/**
|
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 a=(0,s(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},9307:function(e,t,s){"use strict";s.d(t,{Cl:function(){return l},OE:function(){return d}});var a=s(5893);s(7294);var r=s(8799),n=s(6989),c=s(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,a.jsx)(r.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":default:return(0,a.jsx)(c.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,a.jsx)(c.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,a.jsx)(c.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,a.jsx)(c.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,a.jsx)(c.J$,{className:"w-3 h-3 mr-1"})}},o=e=>{let t=l(e),s=i(e);return(0,a.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(t),children:[s,e]})},d=e=>{let{status:t}=e;return(0,a.jsx)(n.WH,{content:t,className:"text-muted-foreground text-sm",children:(0,a.jsx)("span",{children:o(t)})})}},7673:function(e,t,s){"use strict";s.d(t,{Ol:function(){return o},Zb:function(){return i},aY:function(){return h},eW:function(){return m},ll:function(){return d}});var a=s(5893),r=s(7294),n=s(5697),c=s.n(n),l=s(2350);let i=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",s),...n,children:r})});i.displayName="Card",i.propTypes={className:c().string,children:c().node};let o=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",s),...n,children:r})});o.displayName="CardHeader",o.propTypes={className:c().string,children:c().node};let d=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("h3",{ref:t,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",s),...n,children:r})});d.displayName="CardTitle",d.propTypes={className:c().string,children:c().node};let u=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("p",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",s),...n,children:r})});u.displayName="CardDescription",u.propTypes={className:c().string,children:c().node};let h=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",s),...n,children:r})});h.displayName="CardContent",h.propTypes={className:c().string,children:c().node};let m=r.forwardRef((e,t)=>{let{className:s,children:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",s),...n,children:r})});m.displayName="CardFooter",m.propTypes={className:c().string,children:c().node}},3266:function(e,t,s){"use strict";s.d(t,{QL:function(){return u},Sl:function(){return o},getClusters:function(){return i}});var a=s(7294),r=s(5821),n=s(3225),c=s(6378);let l={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function i(){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})}),s=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("X-Request-ID"),a=await fetch("".concat(n.f4,"/api/get?request_id=").concat(s)),r=await a.json();return(r.return_value?JSON.parse(r.return_value):[]).map(e=>{let t="",s=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let s=Math.floor((t-3)/2),a=s+(t-3)%2;return 0===s?e.substring(0,a)+"...":e.substring(0,a)+"..."+e.substring(e.length-s)}(t,25)),{status:l[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:s?"".concat(e.cloud," (").concat(s,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,autostop:e.autostop,to_down:e.to_down,jobs:[],command:e.last_creation_command||e.last_use,task_yaml:e.last_creation_yaml||"{}",events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}})}catch(e){return console.error("Error fetching clusters:",e),[]}}async function o(e){let{clusterName:t,jobId:s,onNewLog:a,workspace:c}=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:s,override_skypilot_config:{active_workspace:c||"default"}})})).body.getReader();for(;;){let{done:t,value:s}=await e.read();if(t)break;let r=new TextDecoder().decode(s);a(r)}}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,r.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function d(e){let{clusterName:t,workspace:s}=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,override_skypilot_config:{active_workspace:s}})}),a=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),r=await fetch("".concat(n.f4,"/api/get?request_id=").concat(a)),c=await r.json();return JSON.parse(c.return_value).map(e=>{let a=e.end_at?e.end_at:Date.now()/1e3,r=0,n=0;return e.submitted_at&&(r=a-e.submitted_at),e.start_at&&(n=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:r,job_duration:n,infra:"",logs:"",workspace:s||"default"}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function u(e){let{cluster:t,job:s=null}=e,[r,n]=(0,a.useState)(null),[l,o]=(0,a.useState)(null),[u,h]=(0,a.useState)(!0),[m,f]=(0,a.useState)(!0),x=(0,a.useCallback)(async()=>{if(t)try{h(!0);let e=await c.default.get(i,[{clusterNames:[t]}]);return n(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{h(!1)}return null},[t]),g=(0,a.useCallback)(async e=>{if(t)try{f(!0);let s=await c.default.get(d,[{clusterName:t,workspace:e||"default"}]);o(s)}catch(e){console.error("Error fetching cluster job data:",e)}finally{f(!1)}},[t]),b=(0,a.useCallback)(async()=>{c.default.invalidate(i,[{clusterNames:[t]}]);let e=await x();e&&(c.default.invalidate(d,[{clusterName:t,workspace:e.workspace||"default"}]),await g(e.workspace))},[x,g,t]),N=(0,a.useCallback)(async()=>{r&&(c.default.invalidate(d,[{clusterName:t,workspace:r.workspace||"default"}]),await g(r.workspace))},[g,r,t]);return(0,a.useEffect)(()=>{(async()=>{let e=await x();e&&g(e.workspace)})()},[t,s,x,g]),{clusterData:r,clusterJobData:l,loading:u,clusterDetailsLoading:u,clusterJobsLoading:m,refreshData:b,refreshClusterJobsOnly:N}}},5821:function(e,t,s){"use strict";function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,a=document.getElementById("toast-container");a||((a=document.createElement("div")).id="toast-container",a.className="fixed top-0 right-0 p-4 z-[9999] flex flex-col items-end space-y-2",document.body.appendChild(a));let r=document.createElement("div");switch(r.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":r.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":r.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":r.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:r.className+=" bg-blue-100 border-blue-500 text-blue-800"}return r.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 '),a.appendChild(r),r.querySelector("button").addEventListener("click",()=>{a.removeChild(r)}),setTimeout(()=>{a.contains(r)&&a.removeChild(r)},s),r}s.d(t,{C:function(){return a}})},6378:function(e,t,s){"use strict";s.r(t),s.d(t,{DashboardCache:function(){return r},dashboardCache:function(){return n}});let a=s(1214).ej.DEFAULT_TTL;class r{async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=s.ttl||a,n=!1!==s.refreshOnAccess,c=this._generateKey(e,t),l=e.name||"anonymous",i=this.cache.get(c),o=Date.now();if(i&&o-i.lastUpdated<r){let s=Math.round((o-i.lastUpdated)/1e3);return this._debug("Cache HIT for ".concat(l," (age: ").concat(s,"s, TTL: ").concat(Math.round(r/1e3),"s)")),n&&(this.cache.set(c,{data:i.data,lastUpdated:o}),this._debug("Cache TTL refreshed for ".concat(l))),this.backgroundJobs.has(c)||this._refreshInBackground(e,t,c),i.data}try{let s=await e(...t);return this.cache.set(c,{data:s,lastUpdated:o}),s}catch(e){if(i)return console.warn("Failed to fetch fresh data for ".concat(c,", returning stale data:"),e),i.data;throw e}}invalidate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=this._generateKey(e,t);this.cache.delete(s),this.backgroundJobs.delete(s)}invalidateFunction(e){let t=e.name||"anonymous",s=[];for(let e of this.cache.keys())e.startsWith("".concat(t,"_"))&&s.push(e);s.forEach(e=>{this.cache.delete(e),this.backgroundJobs.delete(e)})}clear(){this.cache.clear(),this.backgroundJobs.clear()}getStats(){return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,keys:Array.from(this.cache.keys())}}getDetailedStats(){let e=Date.now(),t=[];for(let[s,a]of this.cache.entries()){let r=e-a.lastUpdated;t.push({key:s,age:Math.round(r/1e3),lastUpdated:new Date(a.lastUpdated).toISOString(),hasBackgroundJob:this.backgroundJobs.has(s)})}return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,entries:t.sort((e,t)=>e.age-t.age)}}setDebugMode(e){this.debugMode=e}_debug(e){for(var t=arguments.length,s=Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];this.debugMode&&console.log("[DashboardCache] ".concat(e),...s)}_refreshInBackground(e,t,s){this.backgroundJobs.set(s,!0),e(...t).then(e=>{this.cache.set(s,{data:e,lastUpdated:Date.now()})}).catch(e=>{console.warn("Background refresh failed for ".concat(s,":"),e)}).finally(()=>{this.backgroundJobs.delete(s)})}_generateKey(e,t){let s=e.name||"anonymous",a=t.length>0?JSON.stringify(t):"";return"".concat(s,"_").concat(a)}constructor(){this.cache=new Map,this.backgroundJobs=new Map,this.debugMode=!1}}let n=new r;t.default=n},190:function(e,t,s){"use strict";s.r(t),s.d(t,{JobDetailPage:function(){return p}});var a=s(5893),r=s(7294),n=s(9470),c=s(7673),l=s(1664),i=s.n(l),o=s(1163),d=s(3266),u=s(6989),h=s(3626),m=s(8799),f=s(9307),x=s(3001),g=s(9008),b=s.n(g);function N(e){let{cluster:t,job:s,jobData:r,onRefresh:n,isRefreshing:c,loading:l}=e,o=(0,x.X)();return(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsxs)("div",{className:"text-base flex items-center",children:[(0,a.jsx)(i(),{href:"/clusters",className:"text-sky-blue hover:underline",children:"Sky Clusters"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)(i(),{href:"/clusters/".concat(t),className:"text-sky-blue hover:underline",children:t}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsxs)(i(),{href:"/clusters/".concat(t,"/").concat(s),className:"text-sky-blue hover:underline",children:[s,r.job&&"-"!=r.job?" (".concat(r.job,")"):""]})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[(l||c)&&(0,a.jsxs)("div",{className:"flex items-center mr-2",children:[(0,a.jsx)(m.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"text-sm ml-2 text-gray-500",children:"Loading..."})]}),(0,a.jsx)(u.WH,{content:"Refresh",className:"text-muted-foreground",children:(0,a.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,a.jsx)(h.Z,{className:"w-4 h-4 mr-1.5"}),!o&&(0,a.jsx)("span",{children:"Refresh"})]})})]})]})}function p(){let e=(0,o.useRouter)(),{cluster:t,job:s}=e.query,{clusterData:l,clusterJobData:x,loading:g,refreshData:p}=(0,d.QL)({cluster:t}),[y,j]=(0,r.useState)(!1),[w,v]=(0,r.useState)(!0),[_,E]=(0,r.useState)(!1),[k,C]=(0,r.useState)([]),[D,T]=(0,r.useState)(!1),S=(0,r.useMemo)(()=>["INIT","PENDING","SETTING_UP"],[]),I=(0,r.useMemo)(()=>{if(!x||!s)return!0;let e=x.find(e=>e.id==s);return e&&S.includes(e.status)},[x,s,S]);r.useEffect(()=>{!g&&w&&v(!1)},[g,w]),(0,r.useEffect)(()=>{let e=!0;return t&&s&&!I?(E(!0),(0,d.Sl)({clusterName:t,jobId:s,onNewLog:t=>{if(e){let e=(0,u.q8)(t);C(t=>[...t,e])}},workspace:null==l?void 0:l.workspace}).then(()=>{e&&E(!1)}).catch(t=>{e&&(console.error("Error streaming logs:",t),E(!1))})):E(!1),()=>{e=!1}},[t,s,D,I,l]);let L=async()=>{j(!0),T(e=>!e),C([]);try{p&&await p()}catch(e){console.error("Error refreshing data:",e)}finally{j(!1)}};if(!e.isReady)return(0,a.jsx)("div",{children:"Loading..."});let R={id:s};if(l&&x){let e=x.find(e=>e.id==s);e&&(R={...e,infra:l.infra,cluster:l.cluster,user:l.user})}let O=t&&s?"Job: ".concat(s," @ ").concat(t," | SkyPilot Dashboard"):"Job Details | SkyPilot Dashboard";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b(),{children:(0,a.jsx)("title",{children:O})}),(0,a.jsxs)(n.A,{highlighted:"clusters",children:[(0,a.jsx)(N,{cluster:t,job:s,jobData:R,onRefresh:L,isRefreshing:y,loading:g}),g&&w?(0,a.jsxs)("div",{className:"flex items-center justify-center h-64",children:[(0,a.jsx)(m.Z,{size:24,className:"mr-2"}),(0,a.jsx)("span",{children:"Loading..."})]}):(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsx)("div",{id:"details",children:(0,a.jsxs)(c.Zb,{children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Details"})}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job ID"}),(0,a.jsx)("div",{className:"text-base mt-1",children:R.id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Job Name"}),(0,a.jsx)("div",{className:"text-base mt-1",children:R.job})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(f.OE,{status:R.status})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,a.jsx)("div",{className:"text-base mt-1",children:R.user})]}),R.resources&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Requested Resources"}),(0,a.jsx)("div",{className:"text-base mt-1",children:R.resources||"N/A"})]}),R.cluster&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cluster"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(i(),{href:"/clusters/".concat(R.cluster),className:"text-sky-blue hover:underline",children:R.cluster})})]})]})})]})}),(0,a.jsx)("div",{id:"logs",className:"mt-6",children:(0,a.jsxs)(c.Zb,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Logs"}),(0,a.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:"(Logs are not streaming; click refresh to fetch the latest logs.)"})]}),(0,a.jsx)(u.WH,{content:"Refresh logs",className:"text-muted-foreground",children:(0,a.jsx)("button",{onClick:()=>{T(e=>!e),C([])},disabled:_,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,a.jsx)(h.Z,{className:"w-4 h-4 ".concat(_?"animate-spin":"")})})})]}),(0,a.jsx)("div",{className:"p-4",children:I?(0,a.jsx)("div",{className:"bg-[#f7f7f7] flex items-center justify-center py-4 text-gray-500",children:(0,a.jsx)("span",{children:"Waiting for the job to start, please refresh after a while"})}):_?(0,a.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,a.jsx)(m.Z,{size:20,className:"mr-2"}),(0,a.jsx)("span",{children:"Loading..."})]}):(0,a.jsx)("div",{className:"max-h-96 overflow-y-auto",children:(0,a.jsx)(u.$B,{logs:k.join("")})})})]})})]})]})]})}t.default=p}},function(e){e.O(0,[614,470,888,774,179],function(){return e(e.s=4966)}),_N_E=e.O()}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[722],{8706:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters/[cluster]",function(){return t(6996)}])},6639:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});/**
|
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 a=(0,t(998).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},6996:function(e,s,t){"use strict";t.r(s);var a=t(5893),r=t(7294),l=t(8799),n=t(8236),i=t(1163),c=t(9470),d=t(1664),x=t.n(d),m=t(9037),o=t(9307),u=t(7673),h=t(3266),j=t(3626),f=t(5895),N=t(6639),v=t(1272),b=t(6989),y=t(9284),g=t(3001),p=t(9008),w=t.n(p);let _=(e,s)=>{let t="",a="";return e>=0&&(t=e+"m",a=" "),s&&(t+="".concat(a,"(down)")),""===t&&(t="-"),t};function k(e){let{clusterData:s,clusterJobData:t,clusterJobsLoading:l,refreshClusterJobsOnly:i}=e,[c,d]=(0,r.useState)(!1),m=(null==s?void 0:s.command)||(null==s?void 0:s.task_yaml);return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsxs)(u.Zb,{children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Details"})}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,a.jsx)("div",{className:"text-base mt-1",children:(0,a.jsx)(o.OE,{status:s.status})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Cluster"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.cluster})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"User"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.user})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Infra"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.infra?(0,a.jsx)(b.Md,{content:s.full_infra||s.infra,className:"text-sm text-muted-foreground",children:(0,a.jsxs)("span",{children:[(0,a.jsx)(x(),{href:"/infra",className:"text-blue-600 hover:underline",children:s.cloud||s.infra.split("(")[0].trim()}),s.infra.includes("(")&&(0,a.jsx)("span",{children:" "+s.infra.substring(s.infra.indexOf("("))})]})}):"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Resources"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.resources_str_full||s.resources_str||"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Started"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s.time?new Date(s.time).toLocaleString():"N/A"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Autostop"}),(0,a.jsx)("div",{className:"text-base mt-1",children:_(s.autostop,s.to_down)})]}),m&&(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Entrypoint"}),(0,a.jsxs)("div",{className:"space-y-4 mt-3",children:[s.command&&(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3",children:(0,a.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all",children:s.command})})}),s.task_yaml&&"{}"!==s.task_yaml&&(0,a.jsxs)("div",{children:[(0,a.jsx)("button",{onClick:()=>{d(!c)},className:"flex items-center text-left focus:outline-none mb-2 text-gray-700 hover:text-gray-900 transition-colors duration-200",children:(0,a.jsxs)("div",{className:"flex items-center",children:[c?(0,a.jsx)(f.Z,{className:"w-4 h-4 mr-1"}):(0,a.jsx)(N.Z,{className:"w-4 h-4 mr-1"}),(0,a.jsx)("span",{className:"text-base",children:"Show SkyPilot YAML"})]})}),c&&(0,a.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 max-h-96 overflow-y-auto",children:(0,a.jsx)("pre",{className:"text-sm text-gray-800 font-mono whitespace-pre-wrap",children:(e=>{if(!e)return"No YAML available";try{let s=v.ZP.load(e),t=v.ZP.dump(s,{lineWidth:-1,styles:{"!!str":"literal"},quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2}).split("\n"),a=[],r=-1;for(let e=0;e<t.length;e++){let s=t[e],l=s.search(/\S/);0===l&&r>=0&&e>0&&a.push(""),a.push(s),r=l}return a.join("\n").trim()}catch(s){return console.error("YAML formatting error:",s),e}})(s.task_yaml)})})]})]})]})]})})]})}),(0,a.jsx)("div",{className:"mb-8",children:(0,a.jsx)(n.L4,{clusterName:s.cluster,clusterJobData:t,loading:l,refreshClusterJobsOnly:i})})]})}s.default=function(){let e=(0,i.useRouter)(),{cluster:s}=e.query,[t,n]=(0,r.useState)(!1),[d,o]=(0,r.useState)(!0),[u,f]=(0,r.useState)(!1),[N,v]=(0,r.useState)(!1),p=(0,g.X)(),{clusterData:_,clusterJobData:S,loading:C,clusterDetailsLoading:L,clusterJobsLoading:O,refreshData:Z,refreshClusterJobsOnly:A}=(0,h.QL)({cluster:s});r.useEffect(()=>{!L&&d&&o(!1)},[L,d]);let D=async()=>{n(!0),await Z(),n(!1)};if(!e.isReady)return(0,a.jsx)("div",{children:"Loading..."});let E=s?"Cluster: ".concat(s," | SkyPilot Dashboard"):"Cluster Details | SkyPilot Dashboard";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(w(),{children:(0,a.jsx)("title",{children:E})}),(0,a.jsxs)(c.A,{highlighted:"clusters",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsxs)("div",{className:"text-base flex items-center",children:[(0,a.jsx)(x(),{href:"/clusters",className:"text-sky-blue hover:underline",children:"Sky Clusters"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)(x(),{href:"/clusters/".concat(s),className:"text-sky-blue hover:underline",children:s})]}),(0,a.jsx)("div",{className:"text-sm flex items-center",children:(0,a.jsxs)("div",{className:"text-sm flex items-center",children:[(L||t)&&(0,a.jsxs)("div",{className:"flex items-center mr-4",children:[(0,a.jsx)(l.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),_&&(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)(b.WH,{content:"Refresh",className:"text-sm text-muted-foreground",children:(0,a.jsxs)("button",{onClick:D,disabled:L||t,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,a.jsx)(j.Z,{className:"w-4 h-4 mr-1.5"}),!p&&(0,a.jsx)("span",{children:"Refresh"})]})}),(0,a.jsx)(m.GV,{withLabel:!0,cluster:_.cluster,status:_.status,onOpenSSHModal:()=>{f(!0)},onOpenVSCodeModal:()=>{v(!0)}})]})]})})]}),L&&d?(0,a.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,a.jsx)(l.Z,{size:24,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading cluster details..."})]}):_?(0,a.jsx)(k,{clusterData:_,clusterJobData:S,clusterJobsLoading:O,refreshClusterJobsOnly:A}):null,(0,a.jsx)(y.Oh,{isOpen:u,onClose:()=>f(!1),cluster:s}),(0,a.jsx)(y._R,{isOpen:N,onClose:()=>v(!1),cluster:s})]})]})}}},function(e){e.O(0,[614,798,121,470,293,969,856,973,236,37,888,774,179],function(){return e(e.s=8706)}),_N_E=e.O()}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{5833:function(n,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters",function(){return r(3450)}])},3450:function(n,t,r){"use strict";r.r(t),r.d(t,{default:function(){return i}});var u=r(5893);r(7294);var e=r(9008),s=r.n(e),c=r(9037);function i(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(s(),{children:(0,u.jsx)("title",{children:"Clusters | SkyPilot Dashboard"})}),(0,u.jsx)(c.Cc,{})]})}}},function(n){n.O(0,[614,798,121,470,293,856,973,37,888,774,179],function(){return n(n.s=5833)}),_N_E=n.O()}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[810],{5833:function(n,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/clusters",function(){return r(3450)}])},3450:function(n,t,r){"use strict";r.r(t),r.d(t,{default:function(){return i}});var u=r(5893);r(7294);var e=r(9008),s=r.n(e),c=r(9037);function i(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(s(),{children:(0,u.jsx)("title",{children:"Clusters | SkyPilot Dashboard"})}),(0,u.jsx)(c.Cc,{})]})}}},function(n){n.O(0,[614,798,121,470,293,969,856,973,37,888,774,179],function(){return n(n.s=5833)}),_N_E=n.O()}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[490],{4483:function(e,r,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/config",function(){return n(9377)}])},9333:function(e,r,n){"use strict";n.d(r,{Z:function(){return t}});/**
|
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 t=(0,n(998).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},1812:function(e,r,n){"use strict";n.d(r,{X:function(){return i}});var t=n(5893),s=n(7294);let l=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let r=e.message;return r.includes("failed:")&&(r=r.split("failed:")[1].trim()),r.charAt(0).toUpperCase()+r.slice(1)},i=e=>{let{error:r,title:n="Error",onDismiss:i}=e,[a,o]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{r&&o(!1)},[r]),!r||a)return null;let c="string"==typeof r?r:l(r);return(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsxs)("div",{className:"text-sm text-red-800",children:[(0,t.jsxs)("strong",{children:[n,":"]})," ",c]})})]}),(0,t.jsx)("button",{onClick:()=>{o(!0),i&&i()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,t.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},803:function(e,r,n){"use strict";n.d(r,{z:function(){return c}});var t=n(5893),s=n(7294),l=n(8426),i=n(2003),a=n(2350);let o=(0,i.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=s.forwardRef((e,r)=>{let{className:n,variant:s,size:i,asChild:c=!1,...d}=e,u=c?l.g7:"button";return(0,t.jsx)(u,{className:(0,a.cn)(o({variant:s,size:i,className:n})),ref:r,...d})});c.displayName="Button"},7673:function(e,r,n){"use strict";n.d(r,{Ol:function(){return c},Zb:function(){return o},aY:function(){return f},eW:function(){return m},ll:function(){return d}});var t=n(5893),s=n(7294),l=n(5697),i=n.n(l),a=n(2350);let o=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,a.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",n),...l,children:s})});o.displayName="Card",o.propTypes={className:i().string,children:i().node};let c=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,a.cn)("flex flex-col space-y-1.5 p-6",n),...l,children:s})});c.displayName="CardHeader",c.propTypes={className:i().string,children:i().node};let d=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("h3",{ref:r,className:(0,a.cn)("text-2xl font-semibold leading-none tracking-tight",n),...l,children:s})});d.displayName="CardTitle",d.propTypes={className:i().string,children:i().node};let u=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("p",{ref:r,className:(0,a.cn)("text-sm text-muted-foreground",n),...l,children:s})});u.displayName="CardDescription",u.propTypes={className:i().string,children:i().node};let f=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,a.cn)("p-6 pt-0",n),...l,children:s})});f.displayName="CardContent",f.propTypes={className:i().string,children:i().node};let m=s.forwardRef((e,r)=>{let{className:n,children:s,...l}=e;return(0,t.jsx)("div",{ref:r,className:(0,a.cn)("flex items-center p-6 pt-0",n),...l,children:s})});m.displayName="CardFooter",m.propTypes={className:i().string,children:i().node}},9377:function(e,r,n){"use strict";n.r(r),n.d(r,{default:function(){return b}});var t=n(5893),s=n(7294),l=n(1163),i=n(9470);n(1664);var a=n(9008),o=n.n(a),c=n(803),d=n(7673),u=n(7324),f=n(1812),m=n(8799),h=n(9333),x=n(1272),p=n(3225),v=n(6989);function g(){let[e,r]=(0,s.useState)(null),[n,l]=(0,s.useState)(null);return((0,s.useEffect)(()=>{fetch("".concat(p.f4,"/api/health")).then(e=>e.json()).then(e=>{e.version&&r(e.version),e.commit&&l(e.commit)}).catch(e=>{console.error("Error fetching API server version and commit hash:",e)})},[]),e)?(0,t.jsx)(v.Md,{content:n?"Commit: ".concat(n):"Commit information not available",className:"text-sm text-muted-foreground",children:(0,t.jsxs)("div",{className:"text-sm text-gray-500 cursor-help border-b border-dotted border-gray-400 inline-block",children:["Version: ",e]})}):null}function b(){let e=(0,l.useRouter)(),[r,n]=(0,s.useState)(""),[a,p]=(0,s.useState)(!0),[v,b]=(0,s.useState)(!1),[y,j]=(0,s.useState)(null),[N,w]=(0,s.useState)(!1);(0,s.useEffect)(()=>{k()},[]);let k=async()=>{p(!0),j(null);try{let e=await (0,u.iE)();0===Object.keys(e).length?n(""):n(x.ZP.dump(e,{indent:2}))}catch(e){console.error("Error loading config:",e),j(e)}finally{p(!1)}},C=async()=>{b(!0),j(null),w(!1);try{let e=x.ZP.load(r);if(null==e&&(e={}),"object"!=typeof e||Array.isArray(e)){let r="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.";Array.isArray(e),r="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.",j(Error(r)),b(!1);return}await (0,u.rF)(e),w(!0),setTimeout(()=>w(!1),3e3)}catch(e){console.error("Error saving config:",e),j(e)}finally{b(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o(),{children:(0,t.jsx)("title",{children:"Edit SkyPilot Configuration | SkyPilot Dashboard"})}),(0,t.jsxs)(i.A,{highlighted:"workspaces",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,t.jsx)("div",{className:"text-base flex items-center",children:(0,t.jsx)("span",{className:"text-sky-blue",children:"SkyPilot Configuration"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"text-sm flex items-center",children:(a||v)&&(0,t.jsxs)("div",{className:"flex items-center mr-4",children:[(0,t.jsx)(m.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:v?"Applying...":"Loading..."})]})}),(0,t.jsx)(g,{})]})]}),(0,t.jsxs)(d.Zb,{className:"w-full",children:[(0,t.jsx)(d.Ol,{children:(0,t.jsx)(d.ll,{className:"text-base font-normal flex items-center justify-between",children:(0,t.jsx)("span",{children:"Edit SkyPilot API Server Configuration"})})}),(0,t.jsxs)(d.aY,{className:"space-y-4",children:[(0,t.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Refer to the"," ",(0,t.jsx)("a",{href:"https://docs.skypilot.co/en/latest/reference/config.html",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:"SkyPilot Docs"})," ","for details. The configuration should be in YAML format."]}),N&&(0,t.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-6",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsx)("p",{className:"text-sm font-medium text-green-800",children:"Configuration saved successfully!"})})]})}),y&&(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(f.X,{error:y,title:"Failed to apply new configuration",onDismiss:()=>j(null)})}),(0,t.jsx)("div",{className:"w-full",children:(0,t.jsx)("textarea",{value:r,onChange:e=>n(e.target.value),className:"w-full h-96 p-3 border border-gray-300 rounded font-mono text-sm resize-vertical focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a?"Loading configuration...":"# Enter SkyPilot configuration in YAML format\n# Example:\n# kubernetes:\n# allowed_contexts: [default, my-context]",disabled:a||v})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-3 pt-3",children:[(0,t.jsx)(c.z,{variant:"outline",onClick:()=>{e.push("/workspaces")},disabled:v,children:"Cancel"}),(0,t.jsx)(c.z,{onClick:C,disabled:a||v,className:"inline-flex items-center bg-blue-600 hover:bg-blue-700 text-white",children:v?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.Z,{size:16,className:"mr-2"}),"Applying..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Z,{className:"w-4 h-4 mr-1.5"}),"Apply"]})})]})]})]})]})]})}},2003:function(e,r,n){"use strict";n.d(r,{j:function(){return i}});var t=n(512);let s=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=t.W,i=(e,r)=>n=>{var t;if((null==r?void 0:r.variants)==null)return l(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:i,defaultVariants:a}=r,o=Object.keys(i).map(e=>{let r=null==n?void 0:n[e],t=null==a?void 0:a[e];if(null===r)return null;let l=s(r)||s(t);return i[e][l]}),c=n&&Object.entries(n).reduce((e,r)=>{let[n,t]=r;return void 0===t||(e[n]=t),e},{});return l(e,o,null==r?void 0:null===(t=r.compoundVariants)||void 0===t?void 0:t.reduce((e,r)=>{let{class:n,className:t,...s}=r;return Object.entries(s).every(e=>{let[r,n]=e;return Array.isArray(n)?n.includes({...a,...c}[r]):({...a,...c})[r]===n})?[...e,n,t]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}}},function(e){e.O(0,[614,798,470,293,888,774,179],function(){return e(e.s=4483)}),_N_E=e.O()}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[233],{1803:function(n,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/infra/[context]",function(){return r(1200)}])},1200:function(n,t,r){"use strict";r.r(t),r.d(t,{default:function(){return f}});var u=r(5893);r(7294);var e=r(8682),i=r(9008),c=r.n(i);function f(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c(),{children:(0,u.jsx)("title",{children:"Infra | SkyPilot Dashboard"})}),(0,u.jsx)(e.fx,{})]})}}},function(n){n.O(0,[614,470,293,856,682,888,774,179],function(){return n(n.s=1803)}),_N_E=n.O()}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[233],{1803:function(n,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/infra/[context]",function(){return r(1200)}])},1200:function(n,t,r){"use strict";r.r(t),r.d(t,{default:function(){return f}});var u=r(5893);r(7294);var e=r(8682),i=r(9008),c=r.n(i);function f(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c(),{children:(0,u.jsx)("title",{children:"Infra | SkyPilot Dashboard"})}),(0,u.jsx)(e.fx,{})]})}}},function(n){n.O(0,[614,470,293,969,856,682,888,774,179],function(){return n(n.s=1803)}),_N_E=n.O()}]);
|
sky/dashboard/out/_next/static/chunks/pages/{infra-7b4b8e7fa9fa0827.js → infra-13b117a831702196.js}
RENAMED
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[588],{3177:function(n,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/infra",function(){return t(9054)}])},9054:function(n,r,t){"use strict";t.r(r),t.d(r,{default:function(){return f}});var u=t(5893);t(7294);var i=t(8682),e=t(9008),c=t.n(e);function f(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c(),{children:(0,u.jsx)("title",{children:"Infra | SkyPilot Dashboard"})}),(0,u.jsx)(i.fx,{})]})}}},function(n){n.O(0,[614,470,293,856,682,888,774,179],function(){return n(n.s=3177)}),_N_E=n.O()}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[588],{3177:function(n,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/infra",function(){return t(9054)}])},9054:function(n,r,t){"use strict";t.r(r),t.d(r,{default:function(){return f}});var u=t(5893);t(7294);var i=t(8682),e=t(9008),c=t.n(e);function f(){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(c(),{children:(0,u.jsx)("title",{children:"Infra | SkyPilot Dashboard"})}),(0,u.jsx)(i.fx,{})]})}}},function(n){n.O(0,[614,470,293,969,856,682,888,774,179],function(){return n(n.s=3177)}),_N_E=n.O()}]);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[315],{479:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs/[job]",function(){return t(8099)}])},6639:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});/**
|
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 r=(0,t(998).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},3626:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});/**
|
7
|
+
* @license lucide-react v0.407.0 - ISC
|
8
|
+
*
|
9
|
+
* This source code is licensed under the ISC license.
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
11
|
+
*/let r=(0,t(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},9307:function(e,s,t){"use strict";t.d(s,{Cl:function(){return c},OE:function(){return d}});var r=t(5893);t(7294);var n=t(8799),l=t(6989),a=t(3850);let c=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)(n.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":default:return(0,r.jsx)(a.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,r.jsx)(a.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,r.jsx)(a.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,r.jsx)(a.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)(a.J$,{className:"w-3 h-3 mr-1"})}},o=e=>{let s=c(e),t=i(e);return(0,r.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(s),children:[t,e]})},d=e=>{let{status:s}=e;return(0,r.jsx)(l.WH,{content:s,className:"text-muted-foreground text-sm",children:(0,r.jsx)("span",{children:o(s)})})}},7673:function(e,s,t){"use strict";t.d(s,{Ol:function(){return o},Zb:function(){return i},aY:function(){return m},eW:function(){return x},ll:function(){return d}});var r=t(5893),n=t(7294),l=t(5697),a=t.n(l),c=t(2350);let i=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,c.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...l,children:n})});i.displayName="Card",i.propTypes={className:a().string,children:a().node};let o=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,c.cn)("flex flex-col space-y-1.5 p-6",t),...l,children:n})});o.displayName="CardHeader",o.propTypes={className:a().string,children:a().node};let d=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("h3",{ref:s,className:(0,c.cn)("text-2xl font-semibold leading-none tracking-tight",t),...l,children:n})});d.displayName="CardTitle",d.propTypes={className:a().string,children:a().node};let u=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("p",{ref:s,className:(0,c.cn)("text-sm text-muted-foreground",t),...l,children:n})});u.displayName="CardDescription",u.propTypes={className:a().string,children:a().node};let m=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,c.cn)("p-6 pt-0",t),...l,children:n})});m.displayName="CardContent",m.propTypes={className:a().string,children:a().node};let x=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,c.cn)("flex items-center p-6 pt-0",t),...l,children:n})});x.displayName="CardFooter",x.propTypes={className:a().string,children:a().node}},8099:function(e,s,t){"use strict";t.r(s);var r=t(5893),n=t(7294),l=t(8799),a=t(1163),c=t(9470),i=t(7673),o=t(8969),d=t(1664),u=t.n(d),m=t(3626),x=t(5895),f=t(6639),g=t(6989),h=t(9307),j=t(3001),N=t(9008),b=t.n(N),p=t(1272);function y(e){let{jobData:s,activeTab:t,setIsLoadingLogs:a,setIsLoadingControllerLogs:c,isLoadingLogs:i,isLoadingControllerLogs:d,refreshFlag:m}=e,[j,N]=(0,n.useState)(""),[b,y]=(0,n.useState)(""),[v,E]=(0,n.useState)(!1),[L,w]=(0,n.useState)({}),[C,R]=(0,n.useState)(0),[S,I]=(0,n.useState)(0),[T,A]=(0,n.useState)(!1),[k,D]=(0,n.useState)(!1),[_,P]=(0,n.useState)(!1),[Z,F]=(0,n.useState)(!1),O=(0,n.useRef)(null),q=(0,n.useRef)(null),M=(0,n.useRef)(null),G=(0,n.useRef)(null),U=(0,n.useRef)(""),H=(0,n.useRef)(""),B=(0,n.useRef)(null);(0,n.useRef)(0);let W=(0,n.useCallback)(e=>{let s="logs"===e?M:G;if(s.current)for(let t of[()=>s.current.querySelector(".logs-container"),()=>s.current.querySelector('[class*="logs-container"]'),()=>s.current.querySelector('div[style*="overflow"]'),()=>s.current]){let s=t();if(s&&s.scrollHeight>s.clientHeight){s.scrollTop=s.scrollHeight,console.log("Auto-scrolled ".concat(e," to bottom"));break}}},[]),Y=["PENDING","SUBMITTED","STARTING"].includes(s.status),J=["PENDING","SUBMITTED"].includes(s.status),$=["RECOVERING"].includes(s.status),z=e=>{w(s=>({...s,[e]:!s[e]}))},V=e=>{if(!e)return[];try{let s=[],t=e.split(/^---$/m);for(let e=0;e<t.length;e++){let r=t[e].trim();r&&""!==r&&s.push(r)}return(s.length>1?s.slice(1):s).map((e,s)=>{try{let t=p.ZP.load(e),r=p.ZP.dump(t,{lineWidth:-1,styles:{"!!str":"literal"},quotingType:"'",forceQuotes:!1,noRefs:!0,sortKeys:!1,condenseFlow:!1,indent:2}).split("\n"),n=[],l=-1;for(let e=0;e<r.length;e++){let s=r[e],t=s.search(/\S/);0===t&&l>=0&&e>0&&n.push(""),n.push(s),l=t}return{index:s,content:n.join("\n").trim(),preview:K(t)}}catch(t){return console.error("YAML formatting error for document ".concat(s,":"),t),{index:s,content:e,preview:"Invalid YAML"}}})}catch(s){return console.error("YAML formatting error:",s),[{index:0,content:e,preview:"Invalid YAML"}]}},K=e=>"string"==typeof e?e.substring(0,50)+"...":e&&e.name?"name: ".concat(e.name):e&&e.resources?"Task configuration":"YAML document";(0,n.useEffect)(()=>{N(""),R(0),F(!1)},[t,s.id]),(0,n.useEffect)(()=>{y(""),I(0),F(!1)},[t,s.id]);let X=(0,n.useCallback)(function(e,s,t,r){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l="logs"===e?O:q;if(l.current)return console.log("Request already active for ".concat(e,", skipping...")),()=>{};let a=!0,c=new AbortController;return"logs"===e&&(Y||$)?(r(!1),n&&A(!1),()=>{}):"controllerlogs"===e&&J?(r(!1),n&&D(!1),()=>{}):s?(l.current=c,r(!0),P(!0),n&&(t(""),"logs"===e?R(0):I(0)),(0,o.NJ)({jobId:s,controller:"controllerlogs"===e,signal:c.signal,onNewLog:s=>{if(a){let t=(0,g.q8)(s);Z||F(!0),Q(e,t),"logs"===e?R(e=>e+t.length):I(e=>e+t.length)}}}).then(()=>{a&&(r(!1),n&&("logs"===e?A(!1):D(!1)),requestAnimationFrame(()=>{W(e)}))}).catch(s=>{a&&("AbortError"!==s.name&&(console.error("Error streaming ".concat(e,":"),s),s.message&&t(e=>e+"Error fetching logs: ".concat(s.message,"\n"))),r(!1),n&&("logs"===e?A(!1):D(!1)))}).finally(()=>{console.log("Cleaning up ".concat(e," request")),a=!1,l.current===c&&(l.current.abort(),l.current=null),"logs"===e?U.current="":H.current="",B.current&&(clearTimeout(B.current),B.current=null)}),()=>{console.log("Cleaning up ".concat(e," request")),a=!1,l.current===c&&(l.current.abort(),l.current=null),"logs"===e?U.current="":H.current="",B.current&&(clearTimeout(B.current),B.current=null)}):()=>{a=!1}},[Y,J,$,Z]);(0,n.useEffect)(()=>{if(O.current&&(O.current.abort(),O.current=null),!Y&&!$)return X("logs",s.id,N,a)},[s.id,X,a,Y,$]),(0,n.useEffect)(()=>{if(q.current&&(q.current.abort(),q.current=null),!J)return X("controllerlogs",s.id,y,c)},[s.id,X,c,J]),(0,n.useEffect)(()=>{if(m>0&&"logs"===t)return O.current&&(O.current.abort(),O.current=null),A(!0),X("logs",s.id,N,a,!0)},[m,t,s.id,X,a]),(0,n.useEffect)(()=>{if(m>0&&"controllerlogs"===t)return q.current&&(q.current.abort(),q.current=null),D(!0),X("controllerlogs",s.id,y,c,!0)},[m,t,s.id,X,c]),(0,n.useEffect)(()=>()=>{console.log("Cleaning up managed job log requests..."),O.current&&(O.current.abort(),O.current=null),q.current&&(q.current.abort(),q.current=null),B.current&&(clearTimeout(B.current),B.current=null),U.current="",H.current="",a(!1),c(!1),A(!1),D(!1)},[]),(0,n.useEffect)(()=>{let e=()=>{document.hidden?(console.log("Page hidden - pausing log streaming for performance"),B.current&&(clearTimeout(B.current),B.current=null)):console.log("Page visible - resuming normal operation")};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[]),(0,n.useEffect)(()=>{let e=()=>{("logs"===t&&j||"controllerlogs"===t&&b)&&W("logs"===t?"logs":"controllerlogs")};requestAnimationFrame(()=>{requestAnimationFrame(e)})},[t,j,b,W]);let Q=(0,n.useCallback)((e,s)=>{("logs"===e?N:y)(e=>e+s),requestAnimationFrame(()=>{W(e)})},[W]);return"logs"===t?(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",ref:M,children:Y?(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.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 recover, please refresh after a while"})}):Z||j?(0,r.jsx)(g.$B,{logs:j}):i?(0,r.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,r.jsx)(l.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading logs..."})]}):(0,r.jsx)(g.$B,{logs:j})}):"controllerlogs"===t?(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",ref:G,children:J?(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 controller process to start, please refresh after a while"})}):Z||b?(0,r.jsx)(g.$B,{logs:b,controller:!0}):d?(0,r.jsxs)("div",{className:"flex items-center justify-center py-4",children:[(0,r.jsx)(l.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading logs..."})]}):(0,r.jsx)(g.$B,{logs:b,controller:!0})}):(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 (Name)"}),(0,r.jsxs)("div",{className:"text-base mt-1",children:[s.id," ",s.name?"(".concat(s.name,")"):""]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,r.jsxs)("div",{className:"text-base mt-1 flex items-center",children:[(0,r.jsx)(h.OE,{status:s.status}),s.priority&&(0,r.jsxs)("span",{className:"ml-2",children:[" (priority: ",s.priority,")"]})]})]}),(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:s.user})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Requested Resources"}),(0,r.jsx)("div",{className:"text-base mt-1",children:s.requested_resources||"N/A"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Infra"}),(0,r.jsx)("div",{className:"text-base mt-1",children:s.infra?(0,r.jsx)(g.Md,{content:s.full_infra||s.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(u(),{href:"/infra",className:"text-blue-600 hover:underline",children:s.cloud||s.infra.split("(")[0].trim()}),s.infra.includes("(")&&(0,r.jsx)("span",{children:" "+s.infra.substring(s.infra.indexOf("("))})]})}):"-"})]}),(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:s.resources_str_full||s.resources_str||"-"})]}),(s.entrypoint||s.dag_yaml)&&(0,r.jsxs)("div",{className:"col-span-2",children:[(0,r.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Entrypoint"}),(0,r.jsxs)("div",{className:"space-y-4 mt-3",children:[s.entrypoint&&(0,r.jsx)("div",{children:(0,r.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3",children:(0,r.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all",children:s.entrypoint})})}),s.dag_yaml&&"{}"!==s.dag_yaml&&(0,r.jsxs)("div",{children:[(0,r.jsx)("button",{onClick:()=>{E(!v)},className:"flex items-center text-left focus:outline-none mb-2 text-gray-700 hover:text-gray-900 transition-colors duration-200",children:(0,r.jsxs)("div",{className:"flex items-center",children:[v?(0,r.jsx)(x.Z,{className:"w-4 h-4 mr-1"}):(0,r.jsx)(f.Z,{className:"w-4 h-4 mr-1"}),(0,r.jsx)("span",{className:"text-base",children:"Show SkyPilot YAML"})]})}),v&&(0,r.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 max-h-96 overflow-y-auto",children:(()=>{let e=V(s.dag_yaml);return 0===e.length?(0,r.jsx)("div",{className:"text-gray-500",children:"No YAML available"}):1===e.length?(0,r.jsx)("pre",{className:"text-sm text-gray-800 font-mono whitespace-pre-wrap",children:e[0].content}):(0,r.jsx)("div",{className:"space-y-4",children:e.map((e,s)=>(0,r.jsxs)("div",{className:"border-b border-gray-200 pb-4 last:border-b-0",children:[(0,r.jsx)("button",{onClick:()=>z(s),className:"flex items-center justify-between w-full text-left focus:outline-none",children:(0,r.jsxs)("div",{className:"flex items-center",children:[L[s]?(0,r.jsx)(x.Z,{className:"w-4 h-4 mr-2"}):(0,r.jsx)(f.Z,{className:"w-4 h-4 mr-2"}),(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Task ",s+1,": ",e.preview]})]})}),L[s]&&(0,r.jsx)("div",{className:"mt-3 ml-6",children:(0,r.jsx)("pre",{className:"text-sm text-gray-800 font-mono whitespace-pre-wrap",children:e.content})})]},s))})})()})]})]})]})]})}s.default=function(){var e;let s=(0,a.useRouter)(),{job:t,tab:d}=s.query,[x,f]=(0,n.useState)(0),{jobData:h,loading:N}=(0,o.UA)(t,x),[p,v]=(0,n.useState)(!1),[E,L]=(0,n.useState)(!0),[w,C]=(0,n.useState)(!1),[R,S]=(0,n.useState)(!1),[I,T]=(0,n.useState)(!1),[A,k]=(0,n.useState)(!1),[D,_]=(0,n.useState)(!1),[P,Z]=(0,n.useState)(0),[F,O]=(0,n.useState)(0),q=(0,j.X)();n.useEffect(()=>{!N&&E&&L(!1)},[N,E]);let M=e=>{let s=document.getElementById(e);s&&s.scrollIntoView({behavior:"smooth"})};(0,n.useEffect)(()=>{k(!0)},[]),(0,n.useEffect)(()=>{if(!D){let e=new MutationObserver(()=>{let s=document.getElementById("logs-section"),t=document.getElementById("controller-logs-section");("logs"===d&&s||"controllerlogs"===d&&t)&&(_(!0),e.disconnect())});return e.observe(document.body,{childList:!0,subtree:!0}),()=>e.disconnect()}},[D,d]),(0,n.useEffect)(()=>{if(s.isReady&&A&&D&&!I){let e=setTimeout(()=>{"logs"===d?(M("logs-section"),T(!0)):"controllerlogs"===d&&(M("controller-logs-section"),T(!0))},800);return()=>clearTimeout(e)}},[s.isReady,d,I,A,D]),(0,n.useEffect)(()=>{T(!1),_(!1)},[d]);let G=async()=>{v(!0);try{f(e=>e+1),Z(e=>e+1),O(e=>e+1)}catch(e){console.error("Error refreshing data:",e)}finally{v(!1)}};if(!s.isReady)return(0,r.jsx)("div",{children:"Loading..."});let U=null==h?void 0:null===(e=h.jobs)||void 0===e?void 0:e.find(e=>String(e.id)===String(t)),H=t?"Job: ".concat(t," | SkyPilot Dashboard"):"Job Details | SkyPilot Dashboard";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b(),{children:(0,r.jsx)("title",{children:H})}),(0,r.jsxs)(c.A,{highlighted:"managed-jobs",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)(u(),{href:"/jobs",className:"text-sky-blue hover:underline",children:"Managed Jobs"}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsxs)(u(),{href:"/jobs/".concat(t),className:"text-sky-blue hover:underline",children:[t," ",(null==U?void 0:U.name)?"(".concat(U.name,")"):""]})]}),(0,r.jsxs)("div",{className:"text-sm flex items-center",children:[(N||p||w||R)&&(0,r.jsxs)("div",{className:"flex items-center mr-4",children:[(0,r.jsx)(l.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,r.jsx)(g.WH,{content:"Refresh",className:"text-muted-foreground",children:(0,r.jsxs)("button",{onClick:G,disabled:N||p,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(m.Z,{className:"w-4 h-4 mr-1.5"}),!q&&(0,r.jsx)("span",{children:"Refresh"})]})})]})]}),N&&E?(0,r.jsxs)("div",{className:"flex items-center justify-center py-32",children:[(0,r.jsx)(l.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]}):U?(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsx)("div",{id:"details-section",children:(0,r.jsxs)(i.Zb,{children:[(0,r.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Details"})}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(y,{jobData:U,activeTab:"info",setIsLoadingLogs:C,setIsLoadingControllerLogs:S,isLoadingLogs:w,isLoadingControllerLogs:R,refreshFlag:0})})]})}),(0,r.jsx)("div",{id:"logs-section",className:"mt-6",children:(0,r.jsxs)(i.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)("h3",{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)(g.WH,{content:"Refresh logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>{Z(e=>e+1)},disabled:w,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(m.Z,{className:"w-4 h-4 ".concat(w?"animate-spin":"")})})})]}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(y,{jobData:U,activeTab:"logs",setIsLoadingLogs:C,setIsLoadingControllerLogs:S,isLoadingLogs:w,isLoadingControllerLogs:R,refreshFlag:P})})]})}),(0,r.jsx)("div",{id:"controller-logs-section",className:"mt-6",children:(0,r.jsxs)(i.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)("h3",{className:"text-lg font-semibold",children:"Controller 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)(g.WH,{content:"Refresh controller logs",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>{O(e=>e+1)},disabled:R,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:(0,r.jsx)(m.Z,{className:"w-4 h-4 ".concat(R?"animate-spin":"")})})})]}),(0,r.jsx)("div",{className:"p-4",children:(0,r.jsx)(y,{jobData:U,activeTab:"controllerlogs",setIsLoadingLogs:C,setIsLoadingControllerLogs:S,isLoadingLogs:w,isLoadingControllerLogs:R,refreshFlag:F})})]})})]}):(0,r.jsx)("div",{className:"flex items-center justify-center py-32",children:(0,r.jsx)("span",{children:"Job not found"})})]})]})}}},function(e){e.O(0,[614,798,470,969,888,774,179],function(){return e(e.s=479)}),_N_E=e.O()}]);
|
sky/dashboard/out/_next/static/chunks/pages/{jobs-78a6c5ba3e24c0cf.js → jobs-a76b2700eca236f7.js}
RENAMED
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[142],{1446:function(n,t,u){(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs",function(){return u(8929)}])},8929:function(n,t,u){"use strict";u.r(t),u.d(t,{default:function(){return c}});var e=u(5893),r=u(9008),i=u.n(r),s=u(8236);function c(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i(),{children:(0,e.jsx)("title",{children:"Managed Jobs | SkyPilot Dashboard"})}),(0,e.jsx)(s.Nk,{})]})}}},function(n){n.O(0,[614,121,470,293,856,973,236,888,774,179],function(){return n(n.s=1446)}),_N_E=n.O()}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[142],{1446:function(n,t,u){(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs",function(){return u(8929)}])},8929:function(n,t,u){"use strict";u.r(t),u.d(t,{default:function(){return c}});var e=u(5893),r=u(9008),i=u.n(r),s=u(8236);function c(){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i(),{children:(0,e.jsx)("title",{children:"Managed Jobs | SkyPilot Dashboard"})}),(0,e.jsx)(s.Nk,{})]})}}},function(n){n.O(0,[614,121,470,293,969,856,973,236,888,774,179],function(){return n(n.s=1446)}),_N_E=n.O()}]);
|