@@ -334,7 +334,7 @@ def get_training_set(self, features: Union[List[Feature], List[str]], current_va
334334 if current_values_only :
335335 ts .start_time = ts .end_time
336336
337- if hasattr ( self , ' mlflow_ctx' ) and not return_sql :
337+ if self . mlflow_ctx and not return_sql :
338338 self .mlflow_ctx ._active_training_set : TrainingSet = ts
339339 ts ._register_metadata (self .mlflow_ctx )
340340 return sql if return_sql else self .splice_ctx .df (sql )
@@ -395,7 +395,7 @@ def get_training_set_from_view(self, training_view: str, features: Union[List[Fe
395395 sql = _generate_training_set_history_sql (tvw , features , feature_sets , start_time = start_time , end_time = end_time )
396396
397397 # Link this to mlflow for model deployment
398- if hasattr ( self , ' mlflow_ctx' ) and not return_sql :
398+ if self . mlflow_ctx and not return_sql :
399399 ts = TrainingSet (training_view = tvw , features = features ,
400400 start_time = start_time , end_time = end_time )
401401 self .mlflow_ctx ._active_training_set : TrainingSet = ts
@@ -819,7 +819,7 @@ def run_feature_elimination(self, df, features: List[Union[str, Feature]], label
819819 round_metrics [row ['name' ]] = row ['score' ]
820820 mlflow_results .append (round_metrics )
821821
822- if log_mlflow and hasattr ( self , ' mlflow_ctx' ) :
822+ if log_mlflow and self . mlflow_ctx :
823823 run_name = mlflow_run_name or f'feature_elimination_{ label } '
824824 self .__log_mlflow_results (run_name , rnd , mlflow_results )
825825
0 commit comments