WIP: Add asynchronous runtime support#276
Conversation
Summary of ChangesHello @oeqqwq, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive asynchronous runtime support, fundamentally enhancing the system's ability to handle distributed computations more efficiently. By integrating asynchronous communication primitives, an asynchronous AST evaluator, and an asynchronous HTTP communicator, it enables non-blocking operations and concurrent execution across different parties. This architectural shift is crucial for improving the performance and responsiveness of distributed machine learning tasks, particularly those involving significant I/O or waiting periods. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces asynchronous communication and evaluation capabilities across the system. Key changes include the addition of async_comm.py which defines asynchronous communication interfaces (IAsyncCommunicator, IAsyncCollective), a mixin for collective operations (AsyncCollectiveMixin), and base implementations for message passing (AsyncCommunicatorBase, AsyncThreadCommunicator). The ast.py file is updated to include an accept_async method for asynchronous visitor pattern traversal. A new async_evaluator.py introduces AsyncEvalSemantic and AsyncIterativeEvaluator for asynchronous expression evaluation, leveraging an Executor for CPU-bound tasks and implementing asynchronous versions of shuffle and other operations. The runtime/communicator.py file gains AsyncHttpCommunicator for asynchronous HTTP-based communication. The runtime/server.py and runtime/session.py files are modified to support asynchronous execution of computations, including a new async_execute method in Session and updating FastAPI endpoints to be asynchronous. The runtime/simulation.py is refactored to use asynchronous evaluators and communicators, replacing synchronous thread pool execution with asyncio.gather. Finally, new unit tests for asynchronous communication are added in test_async_comm.py, and tutorial paths are updated. A review comment highlighted a typo (sefl instead of self) in an AsyncCommunicatorBase method. Another significant review comment pointed out that the new asynchronous evaluation in simulation.py lost the detailed exception handling and timeout mechanisms present in the previous synchronous implementation, suggesting the use of asyncio.wait_for and return_exceptions=True with asyncio.gather for improved robustness.
No description provided.