-
Notifications
You must be signed in to change notification settings - Fork 1
git repository #36
base: main
Are you sure you want to change the base?
git repository #36
Conversation
|
Kudos, SonarCloud Quality Gate passed!
|
| url = f'{remote_host}/api/v2/settings/general' | ||
| host_name = urlparse(remote_host).hostname | ||
| res = requests.get(url, headers={"Authorization": f"Bearer {token}"}) | ||
| if res.status_code == 401: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this check we have to verify that the status code is actually 200 and raise an exception if it's not like "Failed to connect to Giskard instance"
giskard/ml_worker/ml_worker.py
Outdated
| host_name = urlparse(remote_host).hostname | ||
| res = requests.get(url, headers={"Authorization": f"Bearer {token}"}) | ||
| if res.status_code == 401: | ||
| raise Exception("Wrong Token") # Not shure of what exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Invalid API Token" seems like a good option
|
|
||
|
|
||
| def clone_git_testing_repository(instance_id: int, is_silent: bool): | ||
| instance_path = os.path.expanduser(f'{settings.home}/{str(instance_id)}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead do:
Path(expand_env_var(settings.home)) / str(instance_id)
in this case it it won't rely on unix forward slash
| import os | ||
| import logging | ||
| import click | ||
| from git import Repo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget to add git to pyproject.toml
giskard/cli.py
Outdated
|
|
||
| def _start_command(is_server, host, port, is_daemon): | ||
| def _start_command(is_server, is_silent, host, port, is_daemon): | ||
| token = click.prompt("Please enter an API Access Token") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of prompting this value directly it's better to declare it as another cli option with a prompt property
like so
https://click.palletsprojects.com/en/8.1.x/options/#prompting
|
There's one unhandled case - the worker started in a "server" mode with In this case it's not worker that connects to Giskard server, but vice versa. So we can't sent an initialization HTTP request and get an instance id back. I suggest that we switch the
Also in case a worker is started in server mode there's no need to setup the git repo since at start time giskard host is not known |
…nches errors. Resolved asked changements








First version