SIENTIAPDE-1094
Update settings for language services, adjust simulator port, enhance error handling in ingestor, and refine Redis feeder script
This commit is contained in:
@@ -16,14 +16,21 @@ POD_ID = os.getenv("HOSTNAME", "localhost")
|
||||
def main():
|
||||
start_prometheus_server()
|
||||
ingestor = Ingestor()
|
||||
ingestor.prepare_ingestor()
|
||||
try:
|
||||
ingestor.prepare_ingestor()
|
||||
except Exception as e:
|
||||
metrics.APP_ERRORS_TOTAL.labels(
|
||||
pod_id=POD_ID).inc() # Increment errors
|
||||
print(f"Failed to prepare ingestor: {e}")
|
||||
exit_signal.set()
|
||||
ingestor.logger.info("Ingestor prepared. Starting main loop.")
|
||||
|
||||
while not exit_signal.is_set():
|
||||
start_time = time() # Start loop timer
|
||||
try:
|
||||
ingestor.loop()
|
||||
metrics.APP_LOOP_COUNT.labels(pod_id=POD_ID).inc() # Increment loop counter
|
||||
metrics.APP_LOOP_COUNT.labels(
|
||||
pod_id=POD_ID).inc() # Increment loop counter
|
||||
|
||||
exit_signal.wait(ingestor.poll_interval)
|
||||
|
||||
@@ -33,7 +40,8 @@ def main():
|
||||
except Exception:
|
||||
print("Exception in main loop. Setting exit_signal flag.")
|
||||
traceback.print_exc()
|
||||
metrics.APP_ERRORS_TOTAL.labels(pod_id=POD_ID).inc() # Increment errors
|
||||
metrics.APP_ERRORS_TOTAL.labels(
|
||||
pod_id=POD_ID).inc() # Increment errors
|
||||
exit_signal.set()
|
||||
finally:
|
||||
# Record loop duration
|
||||
|
||||
@@ -49,13 +49,14 @@ class Ingestor:
|
||||
self.notification_handler = NotificationHandler(
|
||||
servers=self.kafka_servers,
|
||||
logger=self.logger,
|
||||
project_name="OPC_INGESTOR",
|
||||
pipeline_name="-",
|
||||
trigger_name="-",
|
||||
model_name="-",
|
||||
model="-",
|
||||
project_name="OPC_INGESTOR"
|
||||
)
|
||||
|
||||
self.notification_handler.base_notification.pipeline = 'OPC_INGESTOR'
|
||||
self.notification_handler.base_notification.trigger = 'INGESTOR'
|
||||
self.notification_handler.base_notification.model_name = '-'
|
||||
self.notification_handler.base_notification.model_id = '-'
|
||||
|
||||
self.ingestor_manager = None
|
||||
|
||||
def shutdown(self):
|
||||
@@ -79,7 +80,8 @@ class Ingestor:
|
||||
logger = getLogger(__name__)
|
||||
logger.setLevel(getenv("LOG_LEVEL", "INFO"))
|
||||
handler = StreamHandler()
|
||||
formatter = Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||
formatter = Formatter(
|
||||
"%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||
handler.setFormatter(formatter)
|
||||
|
||||
logger.addHandler(handler)
|
||||
|
||||
Reference in New Issue
Block a user