in 5-appinfra/modules/hpc-monte-carlo-infra/mc_run.py [0:0]
def __init__(self):
self.project_id = FLAGS.project_id
self.publisher_client = pubsub_v1.PublisherClient()
self.topic_path = self.publisher_client.topic_path(
self.project_id, FLAGS.incoming_topic_id
)
self.schema_client = SchemaServiceClient()
self.schema_path = self.schema_client.schema_path(
self.project_id, FLAGS.incoming_topic_schema
)
pubsub_schema = self.schema_client.get_schema(
request={"name": self.schema_path}
)
avro_schema = avro.schema.parse(pubsub_schema.definition)
self.writer = DatumWriter(avro_schema)