From 013dd9ea96501a12f28c7d52d8f47ad9febfbf9b Mon Sep 17 00:00:00 2001 From: ch Date: Fri, 28 May 2010 12:24:12 +0200 Subject: catching error during saving prediction dataset --- lazar.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lazar.rb') diff --git a/lazar.rb b/lazar.rb index 5ab9402..9dad1c4 100644 --- a/lazar.rb +++ b/lazar.rb @@ -3,8 +3,6 @@ class Lazar < Model attr_accessor :prediction_dataset def classify(compound_uri,prediction) - - prediction.title += " lazar classification" lazar = YAML.load self.yaml compound = OpenTox::Compound.new(:uri => compound_uri) @@ -171,6 +169,7 @@ post '/:id/?' do # create prediction prediction = OpenTox::Dataset.new prediction.creator = lazar.uri prediction.title = URI.decode YAML.load(lazar.yaml).dependentVariables.split(/#/).last + prediction.title += " lazar classification" if compound_uri lazar.classify(compound_uri,prediction) unless lazar.database_activity?(compound_uri,prediction) @@ -191,7 +190,11 @@ elsif dataset_uri input_dataset.compounds.each do |compound_uri| lazar.classify(compound_uri,prediction) unless lazar.database_activity?(compound_uri,prediction) end - uri = prediction.save.chomp + begin + uri = prediction.save.chomp + rescue + halt 500, "Could not save prediction dataset" + end end halt 202,task_uri end -- cgit v1.2.3