-
Notifications
You must be signed in to change notification settings - Fork 301
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
Improve error message for ImageSpec #2498
Conversation
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
flytekit/image_spec/image_spec.py
Outdated
click.secho("Flytekit assumes that the image already exists.", fg="blue") | ||
return True | ||
click.secho(f"Failed to check if the image exists with error:\n {e}", fg="red") | ||
click.secho(f"Flytekit assumes the image {self.image_name()} already exists.", fg="blue") |
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.
I think this print statement belongs in should_build
instead.
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.
That makes sense, I updated it, thanks!
flytekit/image_spec/image_spec.py
Outdated
return True | ||
|
||
click.secho(f"Failed to check if the image exists with error:\n {e}", fg="red") | ||
click.secho(f"Flytekit assumes the image {self.image_name()} already exists.", fg="blue") |
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.
Same here
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.
done
@@ -107,6 +107,8 @@ def is_container(self) -> bool: | |||
def exist(self) -> bool: | |||
""" | |||
Check if the image exists in the registry. | |||
Return True if the image exists in the registry, False otherwise. | |||
Return None if failed to check if the image exists due to the permission issue or other reasons. |
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.
That Python typing for exist
needs to be updated to include None
.
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.
updated
@@ -153,9 +158,9 @@ def exist(self) -> bool: | |||
f" pip install --upgrade docker" | |||
) | |||
|
|||
click.secho(f"Failed to check if the image exists with error : {e}", fg="red") | |||
click.secho("Flytekit assumes that the image already exists.", fg="blue") |
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.
Can we ensure we handle runtime error nicely in the clean exception in pyflyte
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.
updated
@@ -68,7 +80,7 @@ def execute_command(command: str): | |||
|
|||
if p.returncode != 0: | |||
_, stderr = p.communicate() | |||
raise Exception(f"failed to run command {command} with error {stderr}") | |||
raise Exception(f"failed to run command {command} with error:\n {stderr.decode()}") |
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.
Change this to raise assertionerror
Or runtime or specific error
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.
updated
Signed-off-by: Kevin Su <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2498 +/- ##
==========================================
+ Coverage 71.79% 78.14% +6.34%
==========================================
Files 182 185 +3
Lines 18561 18737 +176
Branches 3654 3662 +8
==========================================
+ Hits 13326 14642 +1316
+ Misses 4592 3471 -1121
+ Partials 643 624 -19 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Kevin Su <[email protected]> Signed-off-by: bugra.gedik <[email protected]>
Signed-off-by: Kevin Su <[email protected]> Signed-off-by: Jan Fiedler <[email protected]>
Signed-off-by: Kevin Su <[email protected]> Signed-off-by: mao3267 <[email protected]>
Tracking issue
NA
Why are the changes needed?
To improve the error message
What changes were proposed in this pull request?
How was this patch tested?
Setup process
Screenshots
Before:
After:
Related PRs
NA
Docs link
NA