summaryrefslogtreecommitdiff
path: root/lazar.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2011-05-16 14:50:55 +0000
committerChristoph Helma <helma@in-silico.ch>2011-05-16 14:50:55 +0000
commit0b64779ad95c7db741ef68a36a58b1fa3f7f5cac (patch)
treefd1f1764db30904a682323de0889ee47ca15d7f0 /lazar.rb
parentcdb886da8ce1f66a715d3d702a65b0abdfa47f8e (diff)
typo in error message Model not found fixed
Diffstat (limited to 'lazar.rb')
-rw-r--r--lazar.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/lazar.rb b/lazar.rb
index 9c76bbb..617ec73 100644
--- a/lazar.rb
+++ b/lazar.rb
@@ -68,13 +68,17 @@ post '/:id/?' do
if compound_uri
cache = PredictionCache.find(:model_uri => @lazar.uri, :compound_uri => compound_uri).first
return cache.dataset_uri if cache and uri_available?(cache.dataset_uri)
- begin
- prediction_uri = @lazar.predict(compound_uri,true,@subjectid).uri
- PredictionCache.create(:model_uri => @lazar.uri, :compound_uri => compound_uri, :dataset_uri => prediction_uri)
- prediction_uri
- rescue
- LOGGER.error "Lazar prediction failed for #{compound_uri} with #{$!} "
- halt 500, "Prediction of #{compound_uri} with #{@lazar.uri} failed."
+ if cache and uri_available?(cache.dataset_uri)
+ return cache.dataset_uri
+ else
+ begin
+ prediction_uri = @lazar.predict(compound_uri,true,@subjectid).uri
+ PredictionCache.create(:model_uri => @lazar.uri, :compound_uri => compound_uri, :dataset_uri => prediction_uri)
+ prediction_uri
+ rescue
+ LOGGER.error "Lazar prediction failed for #{compound_uri} with #{$!} "
+ halt 500, "Prediction of #{compound_uri} with #{@lazar.uri} failed."
+ end
end
elsif dataset_uri
task = OpenTox::Task.create("Predict dataset",url_for("/#{@lazar.id}", :full)) do |task|