Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
amCap1712 committed Dec 1, 2024
1 parent 04dc043 commit 8469957
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions listenbrainz_spark/request_consumer/request_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from kombu import Exchange, Queue, Message, Connection, Consumer
from kombu.entity import PERSISTENT_DELIVERY_MODE
from kombu.mixins import ConsumerProducerMixin
from kombu.utils.debug import setup_logging

import listenbrainz_spark
import listenbrainz_spark.query_map
Expand All @@ -33,6 +34,7 @@
RABBITMQ_HEARTBEAT_TIME = 2 * 60 * 60 # 2 hours -- a full dump import takes 40 minutes right now

logger = logging.getLogger(__name__)
setup_logging(loggers=[logger])


class RequestConsumer(ConsumerProducerMixin):
Expand Down Expand Up @@ -114,6 +116,10 @@ def get_consumers(self, _, channel):
Consumer(channel, queues=[self.spark_request_queue], no_ack=True, on_message=lambda x: self.callback(x))
]

def on_iteration(self):
super().on_iteration()
logger.info("entering consume")

def init_rabbitmq_connection(self):
connection_name = "spark-request-consumer-" + socket.gethostname()
self.connection = Connection(
Expand All @@ -130,7 +136,9 @@ def start(self, app_name):
try:
logger.info('Request consumer started!')
listenbrainz_spark.init_spark_session(app_name)
logger.info('Request consumer, spark session inited!')
self.init_rabbitmq_connection()
logger.info('Request consumer, rabbitmq connected!')
self.run()
except Exception as e:
logger.critical("Error in spark-request-consumer: %s", str(e), exc_info=True)
Expand Down

0 comments on commit 8469957

Please sign in to comment.