Skip to content

Commit

Permalink
Update error
Browse files Browse the repository at this point in the history
  • Loading branch information
bsmartradio committed Mar 21, 2024
1 parent d9020d5 commit d082230
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions python/lsst/ap/association/packageAlerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,19 @@ def _delivery_callback(self, err, msg):
self.log.debug('Message delivered to %s [%d] @ %d', msg.topic(), msg.partition(), msg.offset())

def _server_check(self):
try:
admin_client = AdminClient(self.kafkaAdminConfig)
topics = admin_client.list_topics(timeout=0.5).topics

if not topics:
raise RuntimeError()

except KafkaException as exception:
raise exception
"""Checks if the alert stream credentials are still valid and the
server is contactable.
Raises
-------
KafkaException
Raised if the server us not contactable.
RuntimeError
Raised if the server is contactable but there are no topics
present.
"""
admin_client = AdminClient(self.kafkaAdminConfig)
topics = admin_client.list_topics(timeout=0.5).topics

if not topics:
raise RuntimeError()

0 comments on commit d082230

Please sign in to comment.