Skip to content

Fix: Add Callback Events and Align Hooks in Streaming Loop #407

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

Merged
merged 9 commits into from
Jan 13, 2025

Conversation

bhimrazy
Copy link
Contributor

@bhimrazy bhimrazy commented Jan 9, 2025

What does this PR do?

  • Adds missing before and after callback events for encoding responses in the streaming loop.
  • Also aligns the hooks (after_predict > after_encode_response) and ensures they run only after the generator completes.
    • This ensures that the after hooks are executed only once the generator finishes processing all tasks.

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in GitHub issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@bhimrazy bhimrazy changed the title Fix: add missing before and after callback encode response events Fix: add missing before and after callback events for encode response Jan 9, 2025
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90%. Comparing base (5aef366) to head (37679c4).
Report is 1 commits behind head on main.

Additional details and impacted files
@@         Coverage Diff         @@
##           main   #407   +/-   ##
===================================
  Coverage    89%    90%           
===================================
  Files        31     31           
  Lines      2017   2020    +3     
===================================
+ Hits       1804   1811    +7     
+ Misses      213    209    -4     

@bhimrazy bhimrazy changed the title Fix: add missing before and after callback events for encode response Fix: Add Callback Events and Align Hooks in Streaming Loop Jan 13, 2025
Copy link
Collaborator

@aniketmaurya aniketmaurya left a comment

Choose a reason for hiding this comment

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

Looks great @bhimrazy! let's goo 🚀

@bhimrazy bhimrazy requested a review from aniketmaurya January 13, 2025 19:29
@aniketmaurya aniketmaurya merged commit 7939301 into Lightning-AI:main Jan 13, 2025
21 checks passed
@bhimrazy bhimrazy deleted the fix/add-missing-callback branch January 13, 2025 20:16
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