From fb9964be6e1bd617581d27de8a7bfdc9df14cb04 Mon Sep 17 00:00:00 2001 From: Manuel Gunther Date: Wed, 10 Feb 2016 16:55:06 -0700 Subject: [PATCH] Few fixes --- bob/bio/base/script/grid_search.py | 8 ++++++-- bob/bio/base/tools/extractor.py | 2 +- bob/bio/base/tools/grid.py | 6 ------ bob/bio/base/utils/resources.py | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/bob/bio/base/script/grid_search.py b/bob/bio/base/script/grid_search.py index 8294d0f0..73287b17 100755 --- a/bob/bio/base/script/grid_search.py +++ b/bob/bio/base/script/grid_search.py @@ -266,7 +266,7 @@ def check_requirements(replacements): for key in configuration.replace: # check that the key is one of the known steps if key not in steps: - raise ValueError("The step '%s' defined in the configuration file is unknown; choose one of %s" % (key, steps)) + raise ValueError("The step '%s' defined in the configuration file '%s' is unknown; choose one of %s" % (key, args.configuration_file, steps)) values.update(extract_values(configuration.replace[key], replacements)) for requirement in configuration.requirements: test = replace(requirement, values) @@ -444,6 +444,10 @@ def main(command_line_parameters = None): create_recursive(replace_dict, step_index = 0, directories = {}, dependency_level = 0) # finally, write some information about the - logger.info("The number of executed tasks is: %d, which are split up into %d jobs that are executed in the grid" %(task_count, job_count)) + if args.grid is not None: + logger.info("The number of executed tasks is: %d, which are split up into %d jobs that are executed in the grid" , task_count, job_count) + + if args.parallel is not None: + logger.info("The total amount of finsihed tasks is: %d", task_count) return score_directories diff --git a/bob/bio/base/tools/extractor.py b/bob/bio/base/tools/extractor.py index 384a9991..00d0e932 100644 --- a/bob/bio/base/tools/extractor.py +++ b/bob/bio/base/tools/extractor.py @@ -38,6 +38,7 @@ def train_extractor(extractor, preprocessor, force = False): if utils.check_file(fs.extractor_file, force, 1000): logger.info("- Extraction: extractor '%s' already exists.", fs.extractor_file) else: + bob.io.base.create_directories_safe(os.path.dirname(fs.extractor_file)) # read training files train_files = fs.training_list('preprocessed', 'train_extractor', arrange_by_client = extractor.split_training_data_by_client) train_data = read_preprocessed_data(train_files, preprocessor, extractor.split_training_data_by_client) @@ -46,7 +47,6 @@ def train_extractor(extractor, preprocessor, force = False): else: logger.info("- Extraction: training extractor '%s' using %d training files:", fs.extractor_file, len(train_files)) # train model - bob.io.base.create_directories_safe(os.path.dirname(fs.extractor_file)) extractor.train(train_data, fs.extractor_file) diff --git a/bob/bio/base/tools/grid.py b/bob/bio/base/tools/grid.py index 8a536d12..05cde15c 100644 --- a/bob/bio/base/tools/grid.py +++ b/bob/bio/base/tools/grid.py @@ -114,12 +114,6 @@ def submit(self, command, number_of_parallel_jobs = 1, dependencies=[], name = N return self.fake_job_id - def grid_job_id(self): - id = os.getenv('JOB_ID') - if id is not None: - return int(id) - return id - def execute_local(self): """Starts the local deamon and waits until it has finished.""" logger.info("Starting jman deamon to run the jobs on the local machine.") diff --git a/bob/bio/base/utils/resources.py b/bob/bio/base/utils/resources.py index c2acef4b..3ef80843 100644 --- a/bob/bio/base/utils/resources.py +++ b/bob/bio/base/utils/resources.py @@ -59,7 +59,7 @@ def read_config_file(filename, keyword = None): """ if not os.path.exists(filename): - raise IOError("The given configuration file '%s' could not be found" % file) + raise IOError("The given configuration file '%s' could not be found" % filename) import string import random