summaryrefslogtreecommitdiff
path: root/lazar.rb
diff options
context:
space:
mode:
authorch <ch@toxcreate.in-silico.ch>2010-05-28 12:24:12 +0200
committerch <ch@toxcreate.in-silico.ch>2010-05-28 12:24:12 +0200
commit013dd9ea96501a12f28c7d52d8f47ad9febfbf9b (patch)
tree4c448397759c6a029639fa89e73d868836dabd89 /lazar.rb
parent43a63d1231531c7b1346d74ba50631ce037c9e33 (diff)
catching error during saving prediction dataset
Diffstat (limited to 'lazar.rb')
-rw-r--r--lazar.rb9
1 files changed, 6 insertions, 3 deletions
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