fiftyone.operators.remote_notifier#
FiftyOne operator server SSE notifier for execution store events.
This module provides an SSE notifier that listens for notification requests targeting a specific execution store. When a broadcast is sent to a store, all connected SSE clients subscribed to that store will receive the message.
Classes:
Handles the logic for broadcasting messages and managing client subscriptions for Server-Sent Events (SSE) notifications. |
- class fiftyone.operators.remote_notifier.RemoteNotifier#
Bases:
ABCMethods:
broadcast_to_store(store_name, message)Broadcast a message to all remote subscribers of the given store.
- abstract async broadcast_to_store(store_name: str, message: str) None#
Broadcast a message to all remote subscribers of the given store.
- Parameters:
store_name – The name of the store to which the message should be broadcast.
message – The message payload to send to the subscribers.
- class fiftyone.operators.remote_notifier.SseNotifier#
Bases:
RemoteNotifierHandles the logic for broadcasting messages and managing client subscriptions for Server-Sent Events (SSE) notifications.
Methods:
broadcast_to_store(store_name, message)Broadcast a message to all connected SSE clients subscribed to the specified store.
get_event_source_response(store_name[, ...])Creates an EventSourceResponse for a client subscribing to a specific store.
sync_current_state_for_client(queue, store_name)Broadcast the current state of the store to all connected clients.
- async broadcast_to_store(store_name: str, message: str) None#
Broadcast a message to all connected SSE clients subscribed to the specified store. Handles disconnected clients gracefully without raising exceptions.
- Parameters:
store_name – The name of the store to broadcast to.
message – The message to broadcast.
- async get_event_source_response(store_name: str, dataset_id: str | None = None) EventSourceResponse#
Creates an EventSourceResponse for a client subscribing to a specific store. It registers a new queue for the client and produces an async generator to stream events.
- Parameters:
store_name – The name of the store to subscribe to.
dataset_id – Optional dataset ID to filter events by.
- Returns:
An EventSourceResponse for streaming events to the client.
- async sync_current_state_for_client(queue: Queue, store_name: str, dataset_id: str | None = None) None#
Broadcast the current state of the store to all connected clients.