From a48a60c5bdb1f685c077dc27727ce57dc6903fc6 Mon Sep 17 00:00:00 2001 From: Anish Date: Thu, 22 Feb 2024 15:23:23 -0500 Subject: [PATCH] fix nats request path --- .../rosbag_processor.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/telematic_system/historical_data_processing/rosbag2_processing_service/rosbag2_processing_service/rosbag_processor.py b/telematic_system/historical_data_processing/rosbag2_processing_service/rosbag2_processing_service/rosbag_processor.py index 9c885d77..71db5132 100644 --- a/telematic_system/historical_data_processing/rosbag2_processing_service/rosbag2_processing_service/rosbag_processor.py +++ b/telematic_system/historical_data_processing/rosbag2_processing_service/rosbag2_processing_service/rosbag_processor.py @@ -59,28 +59,27 @@ def __init__(self, config = Config()): # Processing status self.is_processing = False - def process_rosbag(self,rosbag2_name): + def process_rosbag(self,rosbag2_path): self.is_processing = True - if Path(rosbag2_name).suffix not in self.config.accepted_file_extensions: + if Path(rosbag2_path).suffix not in self.config.accepted_file_extensions: #TODO update mysql entry for rosbag - raise Exception(f"File type not acceptable for {rosbag2_name}") + raise Exception(f"File type not acceptable for {rosbag2_path}") - measurement_name = Path(rosbag2_name).stem # Measurement name is rosbag name without mcap extension + measurement_name = Path(rosbag2_path).stem # Measurement name is rosbag name without mcap extension + rosbag2_name = Path(rosbag2_path).name - self.logger.info(f"upload_destination_path: {self.config.upload_destination_path}") self.logger.info(f"rosbag name: {rosbag2_name}") - rosbag_path = Path(self.config.upload_destination_path) / Path(rosbag2_name).name - if not Path(rosbag_path).exists(): - self.logger.error(f"File not found {rosbag_path}") + if not Path(rosbag2_path).exists(): + self.logger.error(f"File not found {rosbag2_path}") self.is_processing = False return # Load the rosbag from the config directory try: - for msg in read_ros2_messages(rosbag_path): + for msg in read_ros2_messages(rosbag2_path): if msg.channel.topic in self.config.topic_exclusion_list: continue @@ -93,10 +92,11 @@ def process_rosbag(self,rosbag2_name): self.logger.error(f"Error from Influx Client: {(e)}") except Exception as e: self.logger.error(f"Failed to process ros message with exception: {(e)}") - return + except exceptions.McapError as e: self.logger.error(f"Failed to read from rosbag with exception {(e)} ") + self.is_processing = False return self.logger.info(f"Completed rosbag processing for {rosbag2_name}")