Skip to content

Commit

Permalink
🧹 check logging file handlers in advance
Browse files Browse the repository at this point in the history
  • Loading branch information
jvdd committed Oct 12, 2023
1 parent d837827 commit 8d0d156
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tsflex/features/feature_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,12 @@ def calculate(
+ " already a grouped DataFrame!"
)

# Delete other logging handlers
delete_logging_handlers(logger)
# Add logging handler (if path provided)
if logging_file_path:
f_handler = add_logging_handler(logger, logging_file_path)

if (
group_by_all
or group_by_consecutive
Expand All @@ -1001,6 +1007,7 @@ def calculate(
)

if group_by_consecutive:
# Strided rollling feature extraction will take place
return self._calculate_group_by_consecutive(
data,
group_by_consecutive,
Expand All @@ -1012,6 +1019,7 @@ def calculate(
n_jobs=n_jobs,
)
else:
# Grouped feature extraction will take place
if not isinstance(data, pd.core.groupby.generic.DataFrameGroupBy):
# group_by_all should not be None (checked by asserts above)
assert (
Expand All @@ -1028,16 +1036,9 @@ def calculate(
data,
return_df,
show_progress=show_progress,
# logging_file_path=logging_file_path, # TODO
n_jobs=n_jobs,
)

# Delete other logging handlers
delete_logging_handlers(logger)
# Add logging handler (if path provided)
if logging_file_path:
f_handler = add_logging_handler(logger, logging_file_path)

# Convert to numpy array (if necessary)
if segment_start_idxs is not None:
segment_start_idxs = FeatureCollection._process_segment_idxs(
Expand Down

0 comments on commit 8d0d156

Please sign in to comment.