Skip to content

Commit

Permalink
fixing message logic on log filtering
Browse files Browse the repository at this point in the history
brifordwylie committed Dec 25, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 673f427 commit 8207cd6
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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)

11 changes: 8 additions & 3 deletions src/sageworks/utils/sageworks_logging.py
Original file line number Diff line number Diff line change
@@ -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


2 changes: 1 addition & 1 deletion tests/create_basic_test_artifacts.py
Original file line number Diff line number Diff line change
@@ -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():

0 comments on commit 8207cd6

Please sign in to comment.