broker_utils.types

Pitt-Google types.

class broker.broker_utils.broker_utils.types.AlertFilename(aname)[source]

Filename of an alert stored to a Cloud Storage bucket.

Set self.name to the filename and self.parsed to a ParsedFilename.

Args
aname:

If str, full filename of the alert. If dict, components to create the filename. Required key/value pairs are those needed to create a ParsedFilename. Extra keys are ignored.

class ParsedFilename(topic: Optional[str] = None, objectId: Optional[Union[str, int, float]] = None, sourceId: Optional[Union[str, int, float]] = None, format: str = 'avro')[source]

Component parts of an AlertFilename.

Create new instance of ParsedFilename(topic, objectId, sourceId, format)

format: str

Alias for field number 3

objectId: Union[str, int, float, None]

Alias for field number 1

sourceId: Union[str, int, float, None]

Alias for field number 2

topic: Optional[str]

Alias for field number 0

class broker.broker_utils.broker_utils.types.AlertIds(schema_map, **kwargs)[source]

IDs associated with an alert.

Initialize class instance.

kwargs will be sent to self.extract_ids() and may contain keys:

alert_dict, attrs, filename

extract_ids(alert_dict=None, attrs=None, filename=None, **kwargs)[source]

Extract IDs to an _AlertIds object and return it.

Attempts to extract IDs from alert_dict, attrs, and filename, in that order. kwargs are ignored and only provided for the caller’s convenience.

property id_keys

Return the ID key names used by the survey.

property ids

Alert IDs.

property objectId

Return the objectId.

property sourceId

Return the sourceId.