-
Notifications
You must be signed in to change notification settings - Fork 442
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
[SDK] fix grpc related bugs in Python SDK #2398
[SDK] fix grpc related bugs in Python SDK #2398
Conversation
I passed all the UTs in my local cluster:
But it failed in the CI/CD:
@andreyvelich Could you help me with figuring out what's wrong with the |
Changes I made:
|
6f3ec80
to
73af86d
Compare
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
73af86d
to
8b095ad
Compare
@andreyvelich @johnugeorge @tenzen-y I've resolved this bug. PTAL👀 |
This PR is related to my GSoC project. ref issue: #2340 |
|
||
with open("kubeflow/katib/katib_api_pb2_grpc.py", 'r+') as file: | ||
content = file.read() | ||
new_content = content.replace("api_pb2", "kubeflow.katib.katib_api_pb2") |
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.
Is there a way to avoid this tricky import change ?
Maybe we could add those protobuf files as part of SDK __init__.py
?
https://github.com/kubeflow/katib/blob/8b095add55d7dd8983eba3d3b4bab34d51dc2f35/sdk/python/v1beta1/kubeflow/katib/__init__.py
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.
Yeah, we can achieve this by not renaming those files, i.e. copy api_pb2.py
to python SDK as api_pb2.py
rather than katib_api_pb2.py
.
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.
@andreyvelich I think we may need to do this tricky import change, because adding import kubeflow.katib.api_pb2 as api_pb2
to __init__.py
makes no difference in resolving the import error:
__init__.py
andapi_pb2_grpc.py
are different modules in this directory. Importingapi_pb2
in__init__.py
will not affect package import inapi_pb2_grpc.py
.- Python3 has banned relative package import like
import api_pb2
. Python will search forapi_pb2.py
in thesys.path
rather than the same directory. If we want to use relative import, we need to specify the package path likefrom . import <filename>
.
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 see that makes sense, @droctothorpe @tenzen-y @johnugeorge any thoughts ?
I guess, we still need to modify the import to make sure we import the api_pb2.py
from kubeflow.katib
package.
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.
@Electronic-Waste This import error happened only in the CI, and you have not seen it in your local, right?
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.
Sure,I'll investigate it.
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.
@tenzen-y @andreyvelich I've found a related issue describing this: protocolbuffers/protobuf#7061
The python_package
option is not on the developing schedule up to now. So I think we can't avoid this hack approach now :)
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.
@Electronic-Waste Please can you add the TODO comment in your post-gen script to track this issue: protocolbuffers/protobuf#7061, so maybe in the future we can remove this import re-write.
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.
@andreyvelich I've added the TODO comment to the post-gen scripts now :)
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.
Thanks for investigating this problem.
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
Please run pre-commit to fix lint errors. |
Signed-off-by: Electronic-Waste <[email protected]>
Signed-off-by: Electronic-Waste <[email protected]>
b9bf22e
to
cfa26d5
Compare
Signed-off-by: Electronic-Waste <[email protected]>
cfa26d5
to
7b6fd85
Compare
@andreyvelich Lint error has been fixed now. |
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.
Thanks @Electronic-Waste!
/lgtm
/assign @tenzen-y @johnugeorge
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.
Thanks.
/lgtm
/approve
|
||
with open("kubeflow/katib/katib_api_pb2_grpc.py", 'r+') as file: | ||
content = file.read() | ||
new_content = content.replace("api_pb2", "kubeflow.katib.katib_api_pb2") |
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.
Thanks for investigating this problem.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tenzen-y The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This PR fixes the bug described in issue #2395
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #2395
Checklist: