-
Notifications
You must be signed in to change notification settings - Fork 159
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
fix: replace stream connection API key from kernel id to session id #1622
base: main
Are you sure you want to change the base?
Conversation
- It is better to cast the ID columns using explicit constructor of the subtype. - The stream key is now based on session IDs, but still the callback's partial arguments are only kernel IDs. This may confuse future code readers. - As of Python 3.8, `functools.partial()` now has correct type inference and support for async functions.
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.
I've done a little refactoring. Added another review to let you look once more.
src/ai/backend/manager/api/stream.py
Outdated
stream_key = session_id | ||
stream_id = uuid.uuid4().hex | ||
app_ctx.stream_proxy_handlers[stream_key].add(myself) | ||
defer(lambda: app_ctx.stream_proxy_handlers[stream_key].discard(myself)) | ||
app_ctx.stream_proxy_handlers[kernel_id].add(myself) | ||
defer(lambda: app_ctx.stream_proxy_handlers[kernel_id].discard(myself)) |
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.
stream_proxy_handlers
in other places (e.g., handle_kernel_terminating()
) still uses kernel.id
as the stream key. We should make the naming of stream_key
consistent in two different usage scenarios in this module.
follow-up #576
Change a key of session connection info from
session_id
tokernel_id
Checklist: (if applicable)