mirar.processors.avro package
Module for producing, and broadcasting, avro alerts
Submodules
mirar.processors.avro.base_avro_exporter module
Module with classes to make avro alert packets
- class mirar.processors.avro.base_avro_exporter.BaseAvroExporter(base_name: str, avro_schema_path: Path | str, output_sub_dir: str = 'avro', save_local: bool = True, broadcast: bool = False)[source]
Bases:
BaseSourceProcessorClass to generate Avro Packets from a dataframe of candidates.
- Attributes:
output_sub_dir (str): output data path. base_name (str): 4-letter code for telescope. save_local (bool): save avro packets to out_sub_dir. broadcast (bool): send to brokers at IPAC.
- base_key = 'AVRO'
- broadcast_single_alert_packet(packet, schema, topic_name)[source]
Sends avro-formatted packets to specified topicname using Kafka. Modified from https://github.com/dekishalay/pgirdps
- Args:
packet (dict): candidate data in avro packed dict format. schema (dict): schema definition. topic_name (str): name of the topic sending to, e.g. ztf_20191221.
- Returns:
(int): 1 if broadcast successful or -1 if candidate not sent.
- description() str[source]
Return a description of the processor
- Returns:
A description of the processor
- make_alerts(source_table: SourceTable) tuple[list[dict], Path, str | None][source]
Make avro alerts from a source table
- Parameters:
source_table – input source table
- Returns:
list of avro alerts, path to save avro alerts to, topic name
mirar.processors.avro.ipac_avro_exporter module
Module with classes to make avro alert packets
- class mirar.processors.avro.ipac_avro_exporter.IPACAvroExporter(*args, topic_prefix: str | None = None, **kwargs)[source]
Bases:
BaseAvroExporterClass to generate Avro Packets from a dataframe of candidates.
- Attributes:
output_sub_dir (str): output data path. base_name (str): 4-letter code for telescope. save_local (bool): save avro packets to out_sub_dir. broadcast (bool): send to brokers at IPAC.