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

Feature/gsk 1814 add a message error when the server is started with version #1445

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions giskard/commands/cli_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,27 @@ def _wait_backend_ready(port: int) -> bool:
return up


def _start(attached=False, version=None):
def _start(attached=False, skip_version_check=False, version=None):
logger.info("Starting Giskard Server")

settings = _get_settings() or {}
port = settings.get("port", 19000)

version = get_version(version)

if not skip_version_check and version != giskard.get_version():
logger.error(
f"""
You're trying to start the server with version '{version}' while currently using Giskard '{giskard.get_version()}'

This might lead to incompatibility issues!
If you want to proceed please add `--skip-version-check` to the start command.

We recommend you to upgrade giskard by running `giskard server stop && giskard server upgrade` in order to fix this issue.
"""
)
return

_pull_image(version)

home_volume = _get_home_volume()
Expand Down Expand Up @@ -269,9 +282,17 @@ def _expose(token):
default=False,
help="Starts the server and attaches to it, displaying logs in console.",
)
@click.option(
"--skip-version-check",
"-s",
"skip_version_check",
is_flag=True,
default=False,
help="Force the server to start with a different version of the giskard python library.",
)
@click.option("--version", "version", required=False, help="Version of Giskard server to start")
@common_options
def start(attached, version):
def start(attached, skip_version_check, version):
"""\b
Start Giskard Server.

Expand All @@ -282,10 +303,11 @@ def start(attached, version):
"giskard-server:start",
{
"attached": attached,
"skip_version_check": skip_version_check,
"version": version,
},
)
_start(attached, version)
_start(attached, skip_version_check, version)


@server.command("stop")
Expand Down