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

Retrieve version logs #57

Merged
merged 4 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .github/workflows/onpush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
- name: Lint with ruff
run: |
poetry run ruff giza
- name: Pre-commit check
run: |
poetry run pre-commit run --all-files
- name: Testing
run: |
poetry run pytest --cov=giza --cov-report term-missing --cov-fail-under=60
2 changes: 1 addition & 1 deletion examples/mnist/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
giza-cli==0.15.1
onnx==1.14.1
onnx>=1.16.0
tf2onnx==1.15.1
torch==2.1.0
torchvision==0.16.0
50 changes: 35 additions & 15 deletions giza/commands/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,13 @@ def list(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -155,9 +159,13 @@ def get(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -229,9 +237,13 @@ def list_proofs(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -278,9 +290,13 @@ def get_proof(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -335,9 +351,13 @@ def download_proof(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down
30 changes: 21 additions & 9 deletions giza/commands/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ def get(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -110,9 +114,13 @@ def list(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -168,9 +176,13 @@ def create(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down
14 changes: 10 additions & 4 deletions giza/commands/reset_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ def handle_http_error(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -97,7 +101,9 @@ def reset_password(
if token is None:
token = prompt_for_input("Please enter your reset token 🎟️")

new_password = prompt_for_input("Please enter your new password 🔑", hide_input=True)
new_password = prompt_for_input(
"Please enter your new password 🔑", hide_input=True
)
confirm_password = prompt_for_input(
"Please confirm your new password 🔑", hide_input=True
)
Expand Down
40 changes: 28 additions & 12 deletions giza/commands/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ def create(debug: Optional[bool] = DEBUG_OPTION) -> None:
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -126,9 +130,13 @@ def login(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -170,9 +178,13 @@ def create_api_key(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -238,9 +250,13 @@ def resend_email(debug: Optional[bool] = DEBUG_OPTION) -> None:
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down
1 change: 1 addition & 0 deletions giza/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from giza.utils.echo import Echo


# TODO: Make sure that this works offline, currently it doesn't
def check_version():
"""
Check if there is a new version available of the cli in pypi to suggest upgrade
Expand Down
2 changes: 1 addition & 1 deletion giza/commands/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get(
with ExceptionHandler(debug=debug):
client = VersionsClient(API_HOST)
version: Version = client.get(model_id, version_id)
print_json(version.model_dump_json())
print_json(version.model_dump_json(exclude={"logs"}))


def transpile(
Expand Down
30 changes: 21 additions & 9 deletions giza/commands/workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ def get(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -114,9 +118,13 @@ def create(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down Expand Up @@ -157,9 +165,13 @@ def delete(
echo.error(f"⛔️Detail -> {info.get('detail')}⛔️")
echo.error(f"⛔️Status code -> {info.get('status_code')}⛔️")
echo.error(f"⛔️Error message -> {info.get('content')}⛔️")
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
) if info.get("request_id") else None
(
echo.error(
f"⛔️Request ID: Give this to an administrator to trace the error -> {info.get('request_id')}⛔️"
)
if info.get("request_id")
else None
)
if debug:
raise e
sys.exit(1)
Expand Down
Loading
Loading