Skip to content

Remove grpc imports from init and add pb package #43

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

Merged
merged 4 commits into from
Dec 5, 2018
Merged

Remove grpc imports from init and add pb package #43

merged 4 commits into from
Dec 5, 2018

Conversation

smacker
Copy link
Contributor

@smacker smacker commented Dec 4, 2018

Superseded #39

The first commit has the same change but correct commit message with the explanation why we need it.
The second re-export grpc stuff as we agreed in a comment to that PR.

Fix the problem reported by @vmarkovtsev:
grpcio has incompatibilies with multiprocessing module.
we may provide functionality that doesn't depend on grpc but it would
still break multiprocessing if we import grpc in __init__.py

See more information (currently opened issues):
- python grpc server with multiprocessing fails
grpc/grpc#16001

- gRPC server on Python 3.6 is incompatible with os.fork()
grpc/grpc#17093

Similar issues;

- grpcio 1.6 python client stuck under multiprocessing
grpc/grpc#12489
- gRPC Python 1.8.2 Library incompatibility with fork()
grpc/grpc#13873

Signed-off-by: Maxim Sukharev <max@smacker.ru>
It makes the api cleaner.
See #39 (comment)
for details.

Signed-off-by: Maxim Sukharev <max@smacker.ru>

from .event_pb2_grpc import *
from .event_pb2 import *
from .grpc import *
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we separate our code from autogenerated one? I would rather explicitly import this:

from lookout.sdk.pb import AnalyzerServicer
from lookout.sdk.grpc import to_grpc_address

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 03c4166

Signed-off-by: Maxim Sukharev <max@smacker.ru>
"""

from .service_analyzer_pb2_grpc import \
AnalyzerServicer, add_AnalyzerServicer_to_server as add_analyzer_to_server
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AnalyzerServicer does not need to be imported here. Sorry - I should have spotted this earlier!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Leftover after copy-past. Thank you!

Signed-off-by: Maxim Sukharev <max@smacker.ru>
Copy link
Contributor

@carlosms carlosms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@smacker smacker merged commit 12ecde2 into src-d:master Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants