Skip to content
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

Closed
wants to merge 12 commits into from
Closed

Streaming protocol #250

wants to merge 12 commits into from

Conversation

JadenFiotto-Kaufman
Copy link
Member

My crowning achievement.

@@ -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":
Copy link
Member

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

Copy link
Member

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):
Copy link
Member

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:
Copy link
Member

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
Copy link
Member

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)?

@JadenFiotto-Kaufman JadenFiotto-Kaufman deleted the streaming-protocol branch October 12, 2024 17:08
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.

2 participants