summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2010-12-14 12:47:16 +0100
committermr <mr@mrautenberg.de>2010-12-14 12:47:16 +0100
commitbaecdfe03a6bff2ee28d687f77b1c6606e102003 (patch)
tree9853a791f1066dbe4f75ba625836633d6de23952
parent1981b852f31223227fc1d384111d5cff59db07ea (diff)
remove token_id from saving in table
-rw-r--r--application.rb6
-rw-r--r--lazar.rb4
2 files changed, 7 insertions, 3 deletions
diff --git a/application.rb b/application.rb
index f11a211..7935577 100644
--- a/application.rb
+++ b/application.rb
@@ -4,13 +4,15 @@ require 'opentox-ruby'
class ModelStore
include DataMapper::Resource
- attr_accessor :prediction_dataset
+ attr_accessor :prediction_dataset, :token_id
property :id, Serial
property :uri, String, :length => 255
property :yaml, Text, :length => 2**32-1
- property :token_id, String, :length => 255
+ #property :token_id, String, :length => 255
property :created_at, DateTime
+ @token_id = nil
+
after :save, :check_policy
private
diff --git a/lazar.rb b/lazar.rb
index c565a74..e930f15 100644
--- a/lazar.rb
+++ b/lazar.rb
@@ -69,6 +69,8 @@ end
# @param [optional,Header] Accept Content-type of prediction, can be either `application/rdf+xml or application/x-yaml`
# @return [text/uri-list] URI of prediction task (dataset prediction) or prediction dataset (compound prediction)
post '/:id/?' do
+ token_id = params[:token_id] if params[:token_id]
+ token_id = request.env["HTTP_TOKEN_ID"] if !token_id and request.env["HTTP_TOKEN_ID"]
@lazar = YAML.load ModelStore.get(params[:id]).yaml
@@ -81,7 +83,7 @@ post '/:id/?' do
cache = PredictionCache.first(:model_uri => @lazar.uri, :compound_uri => compound_uri)
return cache.dataset_uri if cache and uri_available?(cache.dataset_uri)
begin
- prediction_uri = @lazar.predict(compound_uri,true).uri
+ prediction_uri = @lazar.predict(compound_uri,true,token_id).uri
PredictionCache.create(:model_uri => @lazar.uri, :compound_uri => compound_uri, :dataset_uri => prediction_uri)
prediction_uri
rescue