From 02b6f053bfcaeee408e2038314bfd79f152029b4 Mon Sep 17 00:00:00 2001 From: Luca Scarabello <luca.scarabello@sed.ethz.ch> Date: Mon, 24 Apr 2017 14:02:11 +0200 Subject: [PATCH] Improved failed template loading --- mpi/template_manager.py | 1 + mpi/template_matching.py | 20 ++++---------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/mpi/template_manager.py b/mpi/template_manager.py index d7d4b15..0119d1d 100644 --- a/mpi/template_manager.py +++ b/mpi/template_manager.py @@ -37,4 +37,5 @@ class TemplateManager(SequentialLoader): def set_unloadable(self, template): self.remove(template) + del self.map[template] diff --git a/mpi/template_matching.py b/mpi/template_matching.py index 7139e5f..727cff2 100644 --- a/mpi/template_matching.py +++ b/mpi/template_matching.py @@ -195,16 +195,6 @@ class TemplateMatching(object): elif os.path.isfile(errorchunks_file): os.remove(errorchunks_file) - errortemplates_file = os.path.join(self.config.directory, 'errorTemplates.dat') - if self.failed_templates: - def failed_templates_to_row(template): - return {'Template':template} - columns = [('Template',0)] - tmio.save_iter_to_file(self.failed_templates, errortemplates_file, - failed_templates_to_row, columns) - elif os.path.isfile(errortemplates_file): - os.remove(errortemplates_file) - def __user_info(self): """ Inform user of the current status @@ -280,11 +270,6 @@ class TemplateMatching(object): # Stop the execution if we had problem loading templates if self.failed_templates: - ftemplate = self.failed_templates[0] - start, shift, mag = self.template_mngr.get_template(ftemplate) - self.logger.error("Error: couldn't load template for time '%s'. To continue either " - "delete/comment the event from catalog to exclude it or fix the " - "waveform archive so that the template can be loaded." % (start)) break # We have finished, save last time @@ -307,10 +292,13 @@ class TemplateMatching(object): for l in self.m_template_ldr.get_completed(): template, error = self.m_template_ldr.get_data(l) if error: + start, shift, mag = self.template_mngr.get_template(template) + self.logger.error("Error: couldn't load template for time '%s'. To continue either " + "delete/comment the event from catalog to exclude it or fix the " + "waveform archive so that the template can be loaded." % (start)) self.template_mngr.set_unloadable(template) self.scanner_mngr.remove_template(template) # useful when continuing previous run self.failed_templates.append(template) - self.logger.warning('(Error) Loading template %d' % (template) ) else: self.template_mngr.set_loaded(template) self.scanner_mngr.add_template_to_process(template) -- GitLab