Skip to content

Commit 40c9cb6

Browse files
Merge pull request #1445 from Giskard-AI/feature/gsk-1814-add-a-message-error-when-the-server-is-started-with-version
Feature/gsk 1814 add a message error when the server is started with version
2 parents 6ee3b17 + 0ad5923 commit 40c9cb6

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

‎giskard/commands/cli_server.py‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,27 @@ def _wait_backend_ready(port: int) -> bool:
118118
return up
119119

120120

121-
def _start(attached=False, version=None):
121+
def _start(attached=False, skip_version_check=False, version=None):
122122
logger.info("Starting Giskard Server")
123123

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

127127
version = get_version(version)
128128

129+
if not skip_version_check and version != giskard.get_version():
130+
logger.error(
131+
f"""
132+
You're trying to start the server with version '{version}' while currently using Giskard '{giskard.get_version()}'
133+
134+
This might lead to incompatibility issues!
135+
If you want to proceed please add `--skip-version-check` to the start command.
136+
137+
We recommend you to upgrade giskard by running `giskard server stop && giskard server upgrade` in order to fix this issue.
138+
"""
139+
)
140+
return
141+
129142
_pull_image(version)
130143

131144
home_volume = _get_home_volume()
@@ -269,9 +282,17 @@ def _expose(token):
269282
default=False,
270283
help="Starts the server and attaches to it, displaying logs in console.",
271284
)
285+
@click.option(
286+
"--skip-version-check",
287+
"-s",
288+
"skip_version_check",
289+
is_flag=True,
290+
default=False,
291+
help="Force the server to start with a different version of the giskard python library.",
292+
)
272293
@click.option("--version", "version", required=False, help="Version of Giskard server to start")
273294
@common_options
274-
def start(attached, version):
295+
def start(attached, skip_version_check, version):
275296
"""\b
276297
Start Giskard Server.
277298
@@ -282,10 +303,11 @@ def start(attached, version):
282303
"giskard-server:start",
283304
{
284305
"attached": attached,
306+
"skip_version_check": skip_version_check,
285307
"version": version,
286308
},
287309
)
288-
_start(attached, version)
310+
_start(attached, skip_version_check, version)
289311

290312

291313
@server.command("stop")

0 commit comments

Comments
 (0)