-
Notifications
You must be signed in to change notification settings - Fork 42
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
Streaming protocol #250
Streaming protocol #250
Conversation
@@ -179,6 +180,9 @@ def remote_backend_handle_result_value(self, value: Dict[str, Any]) -> None: | |||
# TODO : graph mismatch handle. hash json ? | |||
for node_name, node_value in value.items(): | |||
self.graph.nodes[node_name]._value = node_value | |||
|
|||
def remote_backend_get_stream_node(self, name: str, graph_id: str) -> "Node": |
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 get that the function name provides context for when the function is called (and perhaps the only actual usecase), but why not use a more general name, like get_node()
? It is just a getter function afterall
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.
Oh I see, it overwrites the function signature in RemoteBackend
, and you addressed it with a comment. Is there a reason why this needs to be inherited from RemoteBackend
, instead of from GraphBasedContext
or just defined directly in this class? (If there is a good reason, I feel like it should be documented)
|
||
def __call__(self, obj: RemoteMixin): | ||
def __call__(self, object: RemoteMixin): |
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.
This function is way easier to read now!
obj.remote_backend_cleanup() | ||
|
||
def handle_response(self, data: Any) -> "ResponseModel": | ||
def handle_response(self, response: "ResponseModel") -> 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.
For readability, I think that blocking_request()
and non_blocking_request()
should be placed immediately after __call__()
|
||
return apply(fn, *args, **kwargs) | ||
|
||
return inner |
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 this pattern defined in numerous locations (__init__.py
, GraphBasedContext.py
). Do you think this could be reused as a util
function (with a descriptive docstring)?
My crowning achievement.