-
Notifications
You must be signed in to change notification settings - Fork 552
[Wrapper] Support awaitable entrypoint output for a sync function #3810
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
Conversation
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.
Looks good!
Really minor comment.
How's this related to the stream changes?
# stream=f) | ||
# profiled_serve_requests_func(num_requests=num_of_events) | ||
# self.assertEqual(num_of_events, self._wrapper._entrypoint.call_count, 'Received unexpected number of events') | ||
async def _collect_packets_async(self, entrypoint_output): |
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.
add newline before function
@TomerShor I reworked logic of whether to await or not and added |
…clio#3810) ### 📝 Description While adding support for streaming (=handler as generators), one of the usecases of sync functions got lost. Namely, the one that is used in mlrun, where handler returns coroutine which later need to be awaited on. This pr ensures that this case is supported and added a test for it to make sure. --- ### 🛠️ Changes Made * fixed the bug * added a test * also, not related to the bug itself, but made sure that all tests are sync as unittest tests should be sync, so wrapped them where needed into `asyncio.run` and added some syntactic sugar --- ### ✅ Checklist - [ ] I updated the documentation (if applicable) - [x] I have tested the changes in this PR --- ### 🧪 Testing UT and test on vmdev(see additional notes) --- ### 🔗 References - Ticket link: https://iguazio.atlassian.net/browse/NUC-594 - Design docs links: - External links: --- ### 🚨 Breaking Changes? - [ ] Yes (explain below) - [x] No <!-- If yes, describe what needs to be changed downstream: --> --- ### 🔍️ Additional Notes Before fix: <img width="2383" height="956" alt="image" src="https://github.com/user-attachments/assets/47ef15b1-40cb-49eb-88f8-b321797f3cfd" /> After: <img width="2232" height="1119" alt="image" src="https://github.com/user-attachments/assets/f261006c-d9e4-4bfc-a187-114f211add90" />
📝 Description
While adding support for streaming (=handler as generators), one of the usecases of sync functions got lost. Namely, the one that is used in mlrun, where handler returns coroutine which later need to be awaited on. This pr ensures that this case is supported and added a test for it to make sure.
🛠️ Changes Made
asyncio.run
and added some syntactic sugar✅ Checklist
🧪 Testing
UT and test on vmdev(see additional notes)
🔗 References
🚨 Breaking Changes?
🔍️ Additional Notes
Before fix:

After:
