Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API server] better error message on API version mismatch #4881

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

aylei
Copy link
Collaborator

@aylei aylei commented Mar 5, 2025

close #4878

Tested locally by modifying the version constant:

# client too old
$ sky status
RuntimeError: Your SkyPilot client is too old: v1 (server version is v3). Please refer to the following link to upgrade your client:
https://docs.skypilot.co/en/latest/getting-started/installation.html

# remote server too old
$ sky status
RuntimeError: SkyPilot API server is too old: v3 (client version is v5). Please refer to the following link to upgrade your server:
https://docs.skypilot.co/en/latest/reference/api-server/api-server.html

# local server too old
$ sky status
RuntimeError: SkyPilot API server is too old: v3 (client version is v5). Please restart the SkyPilot API server with: sky api stop; sky api start

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Manual test see above, also refer to the new unit test case
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: conda deactivate; bash -i tests/backward_compatibility_tests.sh

@aylei aylei marked this pull request as ready for review March 5, 2025 08:35
@aylei aylei changed the title [API server] better Error message on API version mismatch [API server] better error message on API version mismatch Mar 5, 2025
Copy link
Collaborator

@romilbhardwaj romilbhardwaj left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this @aylei!

Comment on lines 273 to 276
# Raised when the server version is not a numeric. A safe
# assumption is that our client is older since we never used
# a non-numeric API version before.
server_is_older = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also we should probably print a warning in debug here that this is not expected, instead of silently assuming the server is newer :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The comment is refined and a debug log is added.

aylei and others added 2 commits March 10, 2025 11:58
@aylei aylei requested a review from romilbhardwaj March 10, 2025 06:19
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 @aylei! A quick comment for the hinting we shown

Comment on lines 58 to +59
f'{colorama.Fore.YELLOW}SkyPilot API server is too old: '
f'v{{server_version}} (client version is v{{client_version}}). '
'Please restart the SkyPilot API server with: '
'sky api stop; sky api start'
f'v{{server_version}} (client version is v{{client_version}}). {{hint}}'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Although we allow vague versions with the internal version, we should not emphasize the internal version number here. We can make it easier for people to take actions, i.e. showing the version/commit of the SkyPilot package they should upgrade to. For example, we should check the server commit/version:

  1. if the server version is something like 1.0.0.dev202xxxx, we should ask user to upgrade their local SkyPilot to skypilot-nightly==202xxx
  2. if the server version is something like 0.x.x, we should ask user to upgrade local SkyPilot to skypilot==0.x.x
  3. if the server version is something like 1.0.0.dev0 and the commit to be abcde, we should asks the user to upgrade local version to a specific commit pip install git+https://github.com...@abcde

Copy link
Collaborator Author

@aylei aylei Mar 11, 2025

Choose a reason for hiding this comment

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

Great idea! Then I think despite which one is older, we should always hint the user to upgrade/downgrade the client to the server version when there is a version mismatch, since the user may not have control over the server deployment. Wdyt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That sounds good to me!

In the server being older case, we can add another sentence, like "contact your admin to upgrade the API server or downgrade your local SkyPilot ... "

Co-authored-by: Zhanghao Wu <[email protected]>
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.

[API server] Refine error message of version mismatch
3 participants