From d3fcafadb048c1fe33c24aab3b981f2e87228cb5 Mon Sep 17 00:00:00 2001 From: Sachin Iyer Date: Sun, 29 Dec 2024 12:01:34 -0800 Subject: [PATCH] chore: create alias to source sky env in dev mode --- sky/templates/jobs-controller.yaml.j2 | 6 +++--- sky/templates/sky-serve-controller.yaml.j2 | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sky/templates/jobs-controller.yaml.j2 b/sky/templates/jobs-controller.yaml.j2 index 71c808fdd0f..f18582421e5 100644 --- a/sky/templates/jobs-controller.yaml.j2 +++ b/sky/templates/jobs-controller.yaml.j2 @@ -21,9 +21,9 @@ setup: | {{cmd}} {%- endfor %} - {% if is_dev %} - # Internal: disable logging for manually logging into the jobs controller for debugging. - echo 'export SKYPILOT_DEV=1' >> ~/.bashrc + {% if controller_envs.get("SKYPILOT_DEV") %} + grep -q "export SKYPILOT_DEV=" ~/.bashrc || echo 'export SKYPILOT_DEV=1' >> ~/.bashrc + grep -q "alias sky-env=" ~/.bashrc || echo 'alias sky-env="{{ sky_activate_python_env }}"' >> ~/.bashrc {% endif %} # Create systemd service file diff --git a/sky/templates/sky-serve-controller.yaml.j2 b/sky/templates/sky-serve-controller.yaml.j2 index 507a6e3a325..48854ed57f5 100644 --- a/sky/templates/sky-serve-controller.yaml.j2 +++ b/sky/templates/sky-serve-controller.yaml.j2 @@ -15,6 +15,11 @@ setup: | {{cmd}} {%- endfor %} + {% if controller_envs.get("SKYPILOT_DEV") %} + grep -q "export SKYPILOT_DEV=" ~/.bashrc || echo 'export SKYPILOT_DEV=1' >> ~/.bashrc + grep -q "alias sky-env=" ~/.bashrc || echo 'alias sky-env="{{ sky_activate_python_env }}"' >> ~/.bashrc + {% endif %} + # Install serve dependencies. # TODO(tian): Gather those into serve constants. pip list | grep uvicorn > /dev/null 2>&1 || pip install uvicorn > /dev/null 2>&1