Skip to content

Conversation

rokatyy
Copy link
Contributor

@rokatyy rokatyy commented Sep 17, 2025

📝 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)
  • I have tested the changes in this PR

🧪 Testing

UT and test on vmdev(see additional notes)


🔗 References


🚨 Breaking Changes?

  • Yes (explain below)
  • No

🔍️ Additional Notes

Before fix:
image

After:
image

@rokatyy rokatyy marked this pull request as ready for review September 17, 2025 17:01
Copy link
Contributor

@TomerShor TomerShor left a 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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add newline before function

@rokatyy
Copy link
Contributor Author

rokatyy commented Sep 17, 2025

@TomerShor I reworked logic of whether to await or not and added _should_await_entrypoint which is based on the function type, not on function output type. We resolve it once at the wrapper start.
This flow is different, because we check not the type of the function, but the type of entrypoint output. I still think that this flow of awaiting on entrypoint_output is a real hack, but we need it for BC.

@rokatyy rokatyy merged commit a22c0bc into nuclio:development Sep 18, 2025
15 checks passed
rokatyy added a commit to rokatyy/nuclio that referenced this pull request Sep 18, 2025
…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"
/>
rokatyy added a commit that referenced this pull request Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants