From 8207cd654d4dbd2412a4da828b3965e3f8e53abc Mon Sep 17 00:00:00 2001 From: Brian Wylie Date: Mon, 25 Dec 2023 14:27:47 -0700 Subject: [PATCH] fixing message logic on log filtering --- .../pandas_transforms/pandas_to_features.py | 2 +- src/sageworks/utils/sageworks_logging.py | 11 ++++++++--- tests/create_basic_test_artifacts.py | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/sageworks/core/transforms/pandas_transforms/pandas_to_features.py b/src/sageworks/core/transforms/pandas_transforms/pandas_to_features.py index ac3232fb2..9258d0e3c 100644 --- a/src/sageworks/core/transforms/pandas_transforms/pandas_to_features.py +++ b/src/sageworks/core/transforms/pandas_transforms/pandas_to_features.py @@ -333,7 +333,7 @@ def post_transform(self, **kwargs): self.output_feature_set.set_status("initializing") # Wait for offline storage of the Feature Group to be ready - self.log.important("Waiting for Feature Group Offline storage to be ready...") + self.log.important("Waiting for AWS Feature Group Offline storage to be ready...") self.log.important("This will often take 10-20 minutes...go have coffee or lunch :)") self.wait_for_rows(self.expected_rows) diff --git a/src/sageworks/utils/sageworks_logging.py b/src/sageworks/utils/sageworks_logging.py index 0a9e088c0..56a1857fe 100644 --- a/src/sageworks/utils/sageworks_logging.py +++ b/src/sageworks/utils/sageworks_logging.py @@ -12,13 +12,18 @@ def __init__(self, rate_seconds=60): self.last_log_times = defaultdict(lambda: 0) def filter(self, record): - last_log_time = self.last_log_times[record.msg] - current_time = time.time() + # Get the message and last log time for this message + message = str(record.msg) + last_log_time = self.last_log_times[message] + + # Return True if this message should be logged (i.e. it's been long enough since the last time) + current_time = time.time() if current_time - last_log_time > self.rate_seconds: - self.last_log_times[record.msg] = current_time + self.last_log_times[message] = current_time return True + # Filter out this message return False diff --git a/tests/create_basic_test_artifacts.py b/tests/create_basic_test_artifacts.py index 834b06f68..4887f1645 100644 --- a/tests/create_basic_test_artifacts.py +++ b/tests/create_basic_test_artifacts.py @@ -55,7 +55,7 @@ # Create the abalone_features FeatureSet if recreate or not FeatureSet("abalone_features").exists(): ds = DataSource("abalone_data") - ds.to_features("abalone_features", target_column="class_number_of_rings") + ds.to_features("abalone_features") # Create the abalone_regression Model if recreate or not Model("abalone-regression").exists():