From 8ca74ee8fd85803d5b1bb801db44496a93b5f716 Mon Sep 17 00:00:00 2001 From: Manuel Gunther <siebenkopf@googlemail.com> Date: Thu, 9 Feb 2017 18:08:13 -0700 Subject: [PATCH] raising errors instead of emitting warnings in case of unsuccessful processing --- bob/bio/base/tools/algorithm.py | 10 ++++------ bob/bio/base/tools/extractor.py | 4 ++-- bob/bio/base/tools/preprocessor.py | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/bob/bio/base/tools/algorithm.py b/bob/bio/base/tools/algorithm.py index c554d917..bcf6a470 100644 --- a/bob/bio/base/tools/algorithm.py +++ b/bob/bio/base/tools/algorithm.py @@ -136,8 +136,8 @@ def project(algorithm, extractor, groups = None, indices = None, allow_missing_f logger.debug("... Projection for extracted file %s failed; skipping", feature_file) continue else: - logger.error("Projection of file '%s' was not successful", feature_file) - continue + raise RuntimeError("Projection of file '%s' was not successful" % feature_file) + # write it algorithm.write_feature(projected, projected_file) @@ -284,8 +284,7 @@ def enroll(algorithm, extractor, compute_zt_norm, indices = None, groups = ['dev logger.debug("... Enrollment for model %s failed; skipping", model_id) continue else: - logger.error("Enrollemnt of model '%s' was not successful", model_id) - continue + raise RuntimeError("Enrollemnt of model '%s' was not successful" % model_id) # save the model algorithm.write_model(model, model_file) @@ -332,8 +331,7 @@ def enroll(algorithm, extractor, compute_zt_norm, indices = None, groups = ['dev logger.debug("... Enrollment for T-model %s failed; skipping", t_model_id) continue else: - logger.error("Enrollemnt of T-model '%s' was not successful", t_model_id) - continue + raise RuntimeError("Enrollemnt of T-model '%s' was not successful", t_model_id) # save model algorithm.write_model(t_model, t_model_file) diff --git a/bob/bio/base/tools/extractor.py b/bob/bio/base/tools/extractor.py index 4940ec4d..7a0b62e2 100644 --- a/bob/bio/base/tools/extractor.py +++ b/bob/bio/base/tools/extractor.py @@ -125,8 +125,8 @@ def extract(extractor, preprocessor, groups=None, indices = None, allow_missing_ logger.debug("... Feature extraction for data file %s failed; skipping", data_file) continue else: - logger.error("Feature extraction of file '%s' was not successful", data_file) - continue + raise RuntimeError("Feature extraction of file '%s' was not successful" % data_file) + # write feature extractor.write_feature(feature, feature_file) diff --git a/bob/bio/base/tools/preprocessor.py b/bob/bio/base/tools/preprocessor.py index 6b81f2a1..045d1e71 100644 --- a/bob/bio/base/tools/preprocessor.py +++ b/bob/bio/base/tools/preprocessor.py @@ -80,9 +80,9 @@ def preprocess(preprocessor, groups = None, indices = None, allow_missing_files if preprocessed_data is None: if allow_missing_files: logger.debug("... Processing original data file '%s' was not successful", file_name) + continue else: - logger.error("Preprocessing of file '%s' was not successful", file_name) - continue + raise RuntimeError("Preprocessing of file '%s' was not successful" % file_name) # write the data preprocessor.write_data(preprocessed_data, preprocessed_data_file) -- GitLab