Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSubscription mode not implemented in Python #7192
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
soltanmm
Jul 1, 2016
Contributor
Could you provide a link to example code (both Python and Go if possible)? It'd be helpful to be able to compare the Go and Python clients to debug the situation.
|
Could you provide a link to example code (both Python and Go if possible)? It'd be helpful to be able to compare the Go and Python clients to debug the situation. |
soltanmm
added
the
lang/Python
label
Jul 1, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
7AC
Jul 1, 2016
Sure! Here it is.
Proto definitions: openconfig.proto. Both stubs have been generated with protobuf 3.0.0-beta-3.
Python:
- generated code
- subscription code (then used here)
- using
grpcio 0.15.0(I was having different issues with0.14which look suspiciously similar to this)
Go:
Any of the following diffs in the Python code results in:
grpc.framework.interfaces.face.face.LocalError: LocalError(code=StatusCode.UNIMPLEMENTED, details="Subscription mode not implemented yet")
- setting
once=True(orFalse, which should be the default anyways)
@@ -24,5 +24,5 @@ def make_subscribe_request(path_str='/'):
"""Create a subscribe request from a string path"""
path = make_path(path_str)
subscription = openconfig_pb2.Subscription(path=path)
- subscription_list = openconfig_pb2.SubscriptionList(subscription=[subscription])
+ subscription_list = openconfig_pb2.SubscriptionList(subscription=[subscription], once=True)
return openconfig_pb2.SubscribeRequest(subscribe=subscription_list)- attempting to set
poll_interval
@@ -24,5 +24,5 @@ def make_subscribe_request(path_str='/'):
"""Create a subscribe request from a string path"""
path = make_path(path_str)
subscription = openconfig_pb2.Subscription(path=path)
- subscription_list = openconfig_pb2.SubscriptionList(subscription=[subscription])
+ subscription_list = openconfig_pb2.SubscriptionList(subscription=[subscription], poll_interval=100)
return openconfig_pb2.SubscribeRequest(subscribe=subscription_list)
7AC
commented
Jul 1, 2016
•
|
Sure! Here it is. Proto definitions: openconfig.proto. Both stubs have been generated with Python:
Go: Any of the following diffs in the Python code results in:
@@ -24,5 +24,5 @@ def make_subscribe_request(path_str='/'):
"""Create a subscribe request from a string path"""
path = make_path(path_str)
subscription = openconfig_pb2.Subscription(path=path)
- subscription_list = openconfig_pb2.SubscriptionList(subscription=[subscription])
+ subscription_list = openconfig_pb2.SubscriptionList(subscription=[subscription], once=True)
return openconfig_pb2.SubscribeRequest(subscribe=subscription_list)
@@ -24,5 +24,5 @@ def make_subscribe_request(path_str='/'):
"""Create a subscribe request from a string path"""
path = make_path(path_str)
subscription = openconfig_pb2.Subscription(path=path)
- subscription_list = openconfig_pb2.SubscriptionList(subscription=[subscription])
+ subscription_list = openconfig_pb2.SubscriptionList(subscription=[subscription], poll_interval=100)
return openconfig_pb2.SubscribeRequest(subscribe=subscription_list) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
remingtonc
Jul 20, 2016
Hi all, any update regarding whether or not subscription is implemented in Python?
remingtonc
commented
Jul 20, 2016
|
Hi all, any update regarding whether or not subscription is implemented in Python? |
nathanielmanistaatgoogle
added this to the Someday... milestone
Jul 21, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nathanielmanistaatgoogle
Jul 28, 2016
Member
Hmm, it looks like many of the Python links that @7AC shared here are no longer valid.
@remingtonc: I'm still unclear on what subscription mode is - can you share the code you've written that you expect to work but that doesn't because of this issue?
|
Hmm, it looks like many of the Python links that @7AC shared here are no longer valid. @remingtonc: I'm still unclear on what subscription mode is - can you share the code you've written that you expect to work but that doesn't because of this issue? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
remingtonc
Jul 29, 2016
@nathanielmanistaatgoogle My personal comment was a misunderstanding on my part. Subscription mode works correctly given its purpose is to subscribe to channel connectivity event changes and not new data in a stream/channel. My initial thought was that subscribe would "subscribe" to a long-term stream/channel and perform a callback when new data arrived. I am uncertain what the original issue is either now that I understand that an iterable is returned that does not necessarily require a "subscription" callback for new data. @7AC will need to clarify their problem further if it is still an issue.
remingtonc
commented
Jul 29, 2016
•
|
@nathanielmanistaatgoogle My personal comment was a misunderstanding on my part. Subscription mode works correctly given its purpose is to subscribe to channel connectivity event changes and not new data in a stream/channel. My initial thought was that subscribe would "subscribe" to a long-term stream/channel and perform a callback when new data arrived. I am uncertain what the original issue is either now that I understand that an iterable is returned that does not necessarily require a "subscription" callback for new data. @7AC will need to clarify their problem further if it is still an issue. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
7AC
commented
Jul 29, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nathanielmanistaatgoogle
Jul 29, 2016
Member
@7AC: Thanks for the updated links. For the circumstance in which you're seeing the undesirable behavior, is the client code written in Python and the server code written in Go? Or some other pairing? Also please ensure that you're using grpcio 1.0.0rc1 (or if you're working from our master source that's fine too).
|
@7AC: Thanks for the updated links. For the circumstance in which you're seeing the undesirable behavior, is the client code written in Python and the server code written in Go? Or some other pairing? Also please ensure that you're using |
nathanielmanistaatgoogle
added
the
requires reporter clarification
label
Aug 9, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jfrabaute
Aug 16, 2016
Hi,
I was investigating a similar problem with a java client instead of python client and found a bug in the server-side code. So, it's highly likely that this is a problem with the specific server-side go code.
I'll validate with @7AC and close this issue if that's the case.
More detail about the bug in case someone runs into the same problem:
Reminder: This is a bidirectionnal rpc method call.
The go server-side code closes the connection when the client RPC stream ends (an EOF is received on the server-side).
On the server-side the goroutine sending the stream will be interrupted as well.
But actually, only the stream is closed and the server should NOT close the connection and continue to stream data to the client.
jfrabaute
commented
Aug 16, 2016
|
Hi, I was investigating a similar problem with a java client instead of python client and found a bug in the server-side code. So, it's highly likely that this is a problem with the specific server-side go code. More detail about the bug in case someone runs into the same problem: |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
7AC
Sep 23, 2016
I can confirm that keeping the connection open on the server side fixed the issue, the Go server can now stream to the Python client continuously.
7AC
commented
Sep 23, 2016
|
I can confirm that keeping the connection open on the server side fixed the issue, the Go server can now stream to the Python client continuously. |
7AC commentedJul 1, 2016
I wrote a client in Python that uses the following
rpc:The
SubscribeRequesthas some options related to choosing between "streaming", "once" and "poll" and the comments mention that "streaming" should be the default. I don't think that's what's happening though since there are a few suspicious things happening.This log message is displayed when the subscription starts:
Attempting to manipulate any "mode" options (e.g., setting
once=Falseorpoll_interval) results in this error:After a few responses (I suspect one per path, i.e., the definition of "once" which should be
Falseby default) we hitEOF:The Go client using the same
.protogoes on forever, which is what made me thing this might be a Python issue. Does this sound plausible at all? If not how could I debug this further?