-
Notifications
You must be signed in to change notification settings - Fork 161
feat(BA-1220): Add redis pubsub broadcaster #4253
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
base: main
Are you sure you want to change the base?
Conversation
except asyncio.CancelledError: | ||
raise | ||
except Exception as e: | ||
log.error("Error while reading broadcasted messages: %s", e) |
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.
log.error("Error while reading broadcasted messages: %s", e) | |
log.error("Error while reading broadcasted messages: {}", e) |
@@ -126,7 +113,6 @@ async def close(self) -> None: | |||
self._closed = True | |||
self._auto_claim_loop_task.cancel() | |||
self._read_messages_task.cancel() | |||
self._read_broadcast_messages_task.cancel() | |||
|
|||
async def _auto_claim_loop(self, autoclaim_start_id: str, autoclaim_idle_timeout: int) -> None: | |||
log.debug("Starting auto claim loop for stream %s", self._stream_key) |
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.
log.debug("Starting auto claim loop for stream %s", self._stream_key) | |
log.debug("Starting auto claim loop for stream {}", self._stream_key) |
@@ -108,7 +95,6 @@ async def close(self) -> None: | |||
await self._conn.close() | |||
self._auto_claim_loop_task.cancel() | |||
self._read_messages_task.cancel() | |||
self._read_broadcast_messages_task.cancel() | |||
|
|||
async def _auto_claim_loop(self, autoclaim_start_id: str, autoclaim_idle_timeout: int) -> None: | |||
log.debug("Starting auto claim loop for stream %s", self._stream_key) |
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.
log.debug("Starting auto claim loop for stream %s", self._stream_key) | |
log.debug("Starting auto claim loop for stream {}", self._stream_key) |
b = dump_json(raw_event) | ||
await self._broadcaster.broadcast(b) |
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.
b = dump_json(raw_event) | |
await self._broadcaster.broadcast(b) | |
await self._broadcaster.broadcast(dump_json(raw_event)) |
Or let's use proper name for b
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.
It is intended that only one action is performed on a line.
When more than one action is performed, it's hard to see when an issue occurs.
@@ -539,9 +551,16 @@ async def event_dispatcher_ctx(root_ctx: RootContext) -> AsyncIterator[None]: | |||
await root_ctx.event_dispatcher.close() | |||
|
|||
|
|||
@dataclass | |||
class EventProcessors: |
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.
Is it correct for the type name to be in plural form?
broadcaster: AbstractBroadcaster | ||
subscriber: AbstractBroadcastSubscriber | ||
|
||
|
||
def _make_message_queue( |
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 think this function name also should be updated since it does not return message queue
resolves #4251 (BA-1220)
Checklist: (if applicable)
ai.backend.test
docs
directory