skypilot: wrap websocket_proxy.py with wrapPythonProgramsIn

This commit is contained in:
Akṣaya Śrīnivāsan
2026-05-31 14:53:26 +05:30
parent 29aca32618
commit 75e8b52ec6
2 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
diff --git a/sky/client/cli/command.py b/sky/client/cli/command.py
index 15a5057d6..5417cad9f 100644
--- a/sky/client/cli/command.py
+++ b/sky/client/cli/command.py
@@ -203,7 +203,6 @@ def _get_cluster_records_and_set_ssh_config(
escaped_key_path = shlex.quote(
(cluster_utils.SSHConfigHelper.generate_local_key_file(
handle.cluster_name, credentials)))
- escaped_executable_path = shlex.quote(sys.executable)
escaped_websocket_proxy_path = shlex.quote(
f'{directory_utils.get_sky_dir()}/templates/websocket_proxy.py')
# Instead of directly use websocket_proxy.py, we add an
@@ -220,8 +219,7 @@ def _get_cluster_records_and_set_ssh_config(
# TODO(zhwu): write the template to a temp file, don't use
# the one in skypilot repo, to avoid changing the file when
# updating skypilot.
- f'\"{escaped_executable_path} '
- f'{escaped_websocket_proxy_path} '
+ f'\"{escaped_websocket_proxy_path} '
f'{server_common.get_server_url()} '
f'{handle.cluster_name} '
f'kubernetes-pod-ssh-proxy\"')
@@ -229,13 +227,11 @@ def _get_cluster_records_and_set_ssh_config(
elif isinstance(handle.launched_resources.cloud, clouds.Slurm):
# Replace the proxy command to proxy through the SkyPilot API
# server with websocket.
- escaped_executable_path = shlex.quote(sys.executable)
escaped_websocket_proxy_path = shlex.quote(
f'{directory_utils.get_sky_dir()}/templates/websocket_proxy.py')
# %w is a placeholder for the node index, substituted per-node
# in cluster_utils.SSHConfigHelper.add_cluster().
- proxy_command = (f'{escaped_executable_path} '
- f'{escaped_websocket_proxy_path} '
+ proxy_command = (f'{escaped_websocket_proxy_path} '
f'{server_common.get_server_url()} '
f'{handle.cluster_name} '
f'slurm-job-ssh-proxy %w')

View File

@@ -37,6 +37,7 @@ python3Packages.buildPythonApplication (finalAttrs: {
patches = [
./0001-Fix-docker-flag-default-for-Click-8.2-compatibility.patch
./0002-Fix-websocket-proxy-call-script-directly-as-executable.patch
];
nativeBuildInputs = [
@@ -221,6 +222,11 @@ python3Packages.buildPythonApplication (finalAttrs: {
cp -r ${dashboard}/* $out/${python3Packages.python.sitePackages}/sky/dashboard/out/
'';
postFixup = ''
chmod +x $out/${python3Packages.python.sitePackages}/sky/templates/websocket_proxy.py
wrapPythonProgramsIn "$out/${python3Packages.python.sitePackages}/sky/templates" "$out ''${pythonPath[*]}"
'';
# Excluding the tests as it fails with error:
# Message: 'Config loaded from /build/source/examples/admin_policy/restful_policy.yaml:\nadmin_policy: http://localhost:8080\n'
#Arguments: ()