Error when encountering a name collision between event streams.
Internal representation of a stream of OrderedBuildEvents.
This class provides in-memory storage of the events in a given Build Event Stream. Many of these Build Event Streams may relate to the same build, or even to the same invocation of a tool.
stream_id (StreamId) – A gRPC message defining the ID of this stream.
publish_event(event: google.devtools.build.v1.publish_build_event_pb2.OrderedBuildEvent) → None¶
OrderedBuildEventinto the stream.
event (OrderedBuildEvent) – The event to publish to the stream. This is an
OrderedBuildEventmessage from the
query_events(query: Optional[str] = None) → Iterator[google.devtools.build.v1.publish_build_event_pb2.OrderedBuildEvent]¶
Query the contents of this stream.
Filter the contents of the event stream by some query, returning an iterator of matching OrderedBuildEvents.
The filtering functionality of this method is currently not implemented, and the iterator returned contains all the events in the stream no matter what query is used.
query (str) – The filter string to use when querying events.
to_grpc_message() → buildgrid.v2.query_build_events_pb2.BuildEventStream¶
Convert this object to a
This method converts this internal event stream representation into a
QueryEventStreamsResponse.BuildEventStreamgRPC message, as defined in the
In-memory storage of Build Event Streams.
This class stores a collection of Build Event Streams, and handles both creation of new streams and querying the streams which already exist based on their stream ID. Streams are stored in-memory and are lost on service restart, so shouldn’t be relied on as a source of persistent data when using this storage class.
This class is similar to the
.*Instanceclasses used by other BuildGrid services, in that it is instantiated by the config parser and used by a
.*Serviceclass instantiated by the server class. Unlike the other instance classes however, this class doesn’t have an
instance_nameattribute due to the Build Events protos not having the concept of multiple instances.
register_instance_with_server(instance_name: str, server: Server)¶
Register this BuildEventStreamStorage with the BuildGrid server
This method doesn’t make a lot of sense here since this isn’t really an “instance” in the same sense as other services have in BuildGrid.
The Build Events protocol doesn’t have support for instance names, so this is the closest thing to an instance we have however. As such this method is implemented to avoid a special case in the config parsing.
The provided instance name is currently ignored.
instance_name (str) – The name of the instance this service is defined in. Currently ignored.
server (Server) – The BuildGrid server to register this storage backend with.
new_stream(stream_id: google.devtools.build.v1.build_events_pb2.StreamId) → buildgrid.server.build_events.storage.BuildEventStream¶
Create and return a new
BuildEventStreamwith the given ID.
stream_id (StreamId) – The gRPC StreamId message containing the ID of the stream to create.
get_stream(stream_id: google.devtools.build.v1.build_events_pb2.StreamId) → buildgrid.server.build_events.storage.BuildEventStream¶
BuildEventStreamwith the given stream ID.
This method takes a stream ID, converts it to a stream key, and returns the stream with that key if one exists.
This method will create a new
BuildEventStreamif one with the given ID doesn’t exist.
stream_id (StreamId) – The StreamID message from an event to get the
BuildEventStreamwith the given ID, or None.
get_matching_streams(stream_key_regex: str) → List[buildgrid.server.build_events.storage.BuildEventStream]¶
Return a list of event streams which match the given key pattern.
This method takes a regular expression as a string, and returns a list of
BuildEventStreamobjects whose stream key (based on the events’ StreamId) matches the regex.
stream_key_regex (str) – A regular expression to use to find matching streams.
BuildEventStreamobjects which have a key matching the given regex.