Skip to content
Snippets Groups Projects
Commit 24279c9a authored by Taya Snijder's avatar Taya Snijder
Browse files

fixed logging.debug bug in hdf5_writer.py

parent cd8e8e1e
Branches
Tags
1 merge request!141Resolve L2SS-414 "413 2021 09 30 branched from master add writer skip parameter"
...@@ -15,8 +15,7 @@ from devices.sdp.statistics_packet import SSTPacket, XSTPacket, BSTPacket, Stati ...@@ -15,8 +15,7 @@ from devices.sdp.statistics_packet import SSTPacket, XSTPacket, BSTPacket, Stati
import devices.sdp.statistics_collector as statistics_collector import devices.sdp.statistics_collector as statistics_collector
logging.basicConfig(level=logging.INFO) logger = logging.getLogger("statistics_writer")
logger = logging.getLogger("hdf5_writer")
__all__ = ["hdf5_writer"] __all__ = ["hdf5_writer"]
...@@ -100,7 +99,7 @@ class hdf5_writer: ...@@ -100,7 +99,7 @@ class hdf5_writer:
# only write the specified fraction of statistics, skip the rest # only write the specified fraction of statistics, skip the rest
if self.statistics_counter % self.decimation_factor != 0: if self.statistics_counter % self.decimation_factor != 0:
logger.info(f"Skipping statistic with timestamp: {timestamp}. Only writing 1/{self.decimation_factor} statistics") logger.debug(f"Skipping statistic with timestamp: {timestamp}. Only writing 1/{self.decimation_factor} statistics")
# increment even though its skipped # increment even though its skipped
self.statistics_counter += 1 self.statistics_counter += 1
...@@ -109,7 +108,7 @@ class hdf5_writer: ...@@ -109,7 +108,7 @@ class hdf5_writer:
# received new statistic, so increment counter # received new statistic, so increment counter
self.statistics_counter += 1 self.statistics_counter += 1
logger.info(f"starting new matrix with timestamp: {timestamp}") logger.debug(f"starting new matrix with timestamp: {timestamp}")
# write the finished (and checks if its the first matrix) # write the finished (and checks if its the first matrix)
if self.current_matrix is not None: if self.current_matrix is not None:
...@@ -128,7 +127,7 @@ class hdf5_writer: ...@@ -128,7 +127,7 @@ class hdf5_writer:
self.statistics_header = None self.statistics_header = None
def write_matrix(self): def write_matrix(self):
logger.info("writing matrix to file") logger.debug("writing matrix to file")
""" """
Writes the finished matrix to the hdf5 file Writes the finished matrix to the hdf5 file
""" """
...@@ -170,7 +169,6 @@ class hdf5_writer: ...@@ -170,7 +169,6 @@ class hdf5_writer:
def process_packet(self, packet): def process_packet(self, packet):
logger.debug(f"Processing packet")
""" """
Adds the newly received statistics packet to the statistics matrix Adds the newly received statistics packet to the statistics matrix
""" """
...@@ -238,5 +236,7 @@ class hdf5_writer: ...@@ -238,5 +236,7 @@ class hdf5_writer:
try: try:
self.write_matrix() self.write_matrix()
finally: finally:
filename = str(self.file)
self.file.close() self.file.close()
logger.debug(f"{self.file} closed") logger.debug(f"{filename} closed")
logger.debug(f"Received a total of {self.statistics_counter} statistics while running. With {int(self.statistics_counter/self.decimation_factor)} written to disk ")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment