Skip to content

Conversation

@cg505
Copy link
Collaborator

@cg505 cg505 commented Aug 25, 2025

If you start the API server with sky api start --foreground, as in our Helm chart, sky api logs --server-logs will not work (TODO: make it work).

Before this change, sky api logs --server-logs would silently return nothing. Now, it should return a somewhat more helpful error message.

Tested (run the relevant ones):

  • Code formatting: install pre-commit (auto-check on commit) or bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: /smoke-test (CI) or pytest tests/test_smoke.py (local)
  • Relevant individual tests: /smoke-test -k test_name (CI) or pytest tests/test_smoke.py::test_name (local)
  • Backward compatibility: /quicktest-core (CI) or pytest tests/smoke_tests/test_backward_compat.py (local)

if log_path == constants.API_SERVER_LOGS:
resolved_log_path = pathlib.Path(
constants.API_SERVER_LOGS).expanduser()
if not resolved_log_path.exists():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible for us to | tee the output to the api srever log path in our helm's sky api start, so people can always get the server log with sky api logs --server-logs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not easily. Currently we use exec so that the main process in the container is the skypilot API server process. To use tee we would not be able to use exec, but that could cause some issues with tini.

# 3. Exec ensures the process is a direct child of tini, enables correct signal handling.
I did look into this and concluded that we would need to do something more complicated, but we should figure out a solution.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I was just a bit worried that people may not have k8s credential locally if they are using a SkyPilot client, but better to have the message printed.

For the message itself, a quick edit:

'Server log file does not exist. The API server may '
'have been started with `--foreground` - check '
'the stdout of API server process, such as: kubectl logs -n api-server-namespace api-server-pod-name'

Copy link
Collaborator Author

cg505 commented Aug 27, 2025

/smoke-test --remote-server

@cg505 cg505 requested a review from Michaelvll August 27, 2025 19:20
Copy link
Collaborator

@Michaelvll Michaelvll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cg505! Left a minor comment.

if log_path == constants.API_SERVER_LOGS:
resolved_log_path = pathlib.Path(
constants.API_SERVER_LOGS).expanduser()
if not resolved_log_path.exists():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I was just a bit worried that people may not have k8s credential locally if they are using a SkyPilot client, but better to have the message printed.

For the message itself, a quick edit:

'Server log file does not exist. The API server may '
'have been started with `--foreground` - check '
'the stdout of API server process, such as: kubectl logs -n api-server-namespace api-server-pod-name'

@cg505 cg505 enabled auto-merge (squash) August 27, 2025 20:03
@cg505 cg505 merged commit 830c019 into skypilot-org:master Aug 27, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants