Skip to content

Commit

Permalink
fixes related to golem 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maypink committed Dec 7, 2023
1 parent 59774e6 commit e6d2740
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
12 changes: 8 additions & 4 deletions fedot/core/caching/pipelines_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ def save_nodes(self, nodes: Union[PipelineNode, List[PipelineNode]], fold_id: Op
]
self._db.add_operations(mapped)
except Exception as ex:
unexpected_exc = not (isinstance(ex, sqlite3.DatabaseError) and 'disk is full' in str(ex))
self.log.warning(f'Nodes can not be saved: {ex}. Continue', exc=ex, raise_if_test=unexpected_exc)
exc_is_expected = (isinstance(ex, sqlite3.DatabaseError) and 'disk is full' in str(ex))
msg = 'Nodes can not be saved'
if exc_is_expected:
self.log.warning(msg, exc_info=ex)
else:
self.log.log_or_raise('warning', ValueError(msg))

def save_pipeline(self, pipeline: 'Pipeline', fold_id: Optional[int] = None):
"""
Expand All @@ -61,8 +65,8 @@ def try_load_nodes(self, nodes: Union[PipelineNode, List[PipelineNode]], fold_id
nodes_lst[idx].fitted_operation = cached_op
else:
nodes_lst[idx].fitted_operation = None
except Exception as ex:
self.log.warning(f'Cache can not be loaded: {ex}. Continue.', exc=ex, raise_if_test=True)
except Exception:
self.log.log_or_raise('info', ValueError('Cache can not be loaded.'))

def try_load_into_pipeline(self, pipeline: 'Pipeline', fold_id: Optional[int] = None):
"""
Expand Down
4 changes: 2 additions & 2 deletions fedot/core/caching/preprocessing_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def try_load_preprocessor(self, pipeline: 'Pipeline', fold_id: Union[int, None])
processors = self._db.get_preprocessor(structural_id)
if processors:
pipeline.encoder, pipeline.imputer = processors
except Exception as ex:
self.log.warning(f'Preprocessor search error: {ex}', raise_if_test=True)
except Exception:
self.log.log_or_raise('warning', ValueError('Preprocessor search error'))

def add_preprocessor(self, pipeline: 'Pipeline', fold_id: Optional[Union[int, None]] = None):
"""
Expand Down
2 changes: 1 addition & 1 deletion fedot/core/composer/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get_value(cls, pipeline: 'Pipeline', reference_data: InputData,
save_path=Path(save_path, 'forecast.png'))

except Exception as ex:
pipeline.log.info(f'Metric can not be evaluated because of: {ex}', raise_if_test=True)
pipeline.log.log_or_raise('info', ValueError('Metric can not be evaluated'))

return metric

Expand Down
4 changes: 2 additions & 2 deletions fedot/core/optimisers/objective/data_objective_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def evaluate(self, graph: Pipeline) -> Fitness:
if evaluated_fitness.valid:
folds_metrics.append(evaluated_fitness.values)
else:
self._log.warning(f'Invalid fitness after objective evaluation. '
f'Skipping the graph: {graph_id}', raise_if_test=True)
self._log.log_or_raise('warning', ValueError(f'Invalid fitness after objective evaluation. '
f'Skipping the graph: {graph_id}'))
if self._do_unfit:
graph.unfit()
if folds_metrics:
Expand Down

0 comments on commit e6d2740

Please sign in to comment.