diff --git a/sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_engine.py b/sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_engine.py index 5f85a1f001..1c9dc6a6be 100644 --- a/sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_engine.py +++ b/sdk/python/feast/infra/materialization/contrib/bytewax/bytewax_materialization_engine.py @@ -248,9 +248,6 @@ def _await_path_materialization( f"(of {total_pods}) complete with status {job.status()}" ) except BaseException as e: - if self.batch_engine_config.print_pod_logs_on_failure: - self._print_pod_logs(job.job_id(), feature_view, batch_start) - logger.info(f"Deleting job {job.job_id()}") try: self.batch_v1.delete_namespaced_job(job.job_id(), self.namespace) @@ -268,6 +265,12 @@ def _await_path_materialization( f"Could not delete configmap due to API Error: {ae.body}" ) + if ( + job.status() == MaterializationJobStatus.ERROR + and self.batch_engine_config.print_pod_logs_on_failure + ): + self._print_pod_logs(job.job_id(), feature_view, batch_start) + return job def _print_pod_logs(self, job_id, feature_view, offset=0):