Skip to content

Commit

Permalink
Enhance jobs-controller.yaml.j2 to check for systemd user service ava…
Browse files Browse the repository at this point in the history
…ilability before executing service management commands. If systemd is not found, implement a manual setup for the SkyPilot dashboard, including process termination and background launch. This improves robustness and user experience during setup.
  • Loading branch information
KeplerC committed Jan 8, 2025
1 parent 81623a7 commit 7a73aba
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions sky/templates/jobs-controller.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,19 @@ setup: |
WantedBy=multi-user.target
EOF

# Reload systemd, enable and start the service
systemctl --user daemon-reload
systemctl --user enable skypilot-dashboard
systemctl --user start skypilot-dashboard
if command -v systemctl &>/dev/null && systemctl --user show &>/dev/null; then
systemctl --user daemon-reload
systemctl --user enable skypilot-dashboard
systemctl --user start skypilot-dashboard
else
echo "Systemd user services not found. Setting up SkyPilot dashboard manually."
# Kill any old dashboard processes
ps aux | grep -v nohup | grep -v grep | grep -- '-m sky.jobs.dashboard.dashboard' \
| awk '{print $2}' | xargs kill > /dev/null 2>&1 || true
# Launch the dashboard in the background if not already running
(ps aux | grep -v nohup | grep -v grep | grep -q -- '-m sky.jobs.dashboard.dashboard') || \
(nohup {{ sky_python_cmd }} -m sky.jobs.dashboard.dashboard >> ~/.sky/job-dashboard.log 2>&1 &)
fi

run: |
{{ sky_activate_python_env }}
Expand Down

0 comments on commit 7a73aba

Please sign in to comment.