From 2226f9dbba9834e42a2b59c428fc45ea8301288c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20G=C3=BCtlein?= Date: Wed, 17 Feb 2010 10:16:35 +0100 Subject: adjust to api changes, added tasks --- example.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'example.rb') diff --git a/example.rb b/example.rb index f9a5529..6e37f21 100644 --- a/example.rb +++ b/example.rb @@ -46,15 +46,19 @@ class Example def self.prepare_example_resources @@summary = "" - delete_all(@@config[:services]["opentox-dataset"]) + #delete_all(@@config[:services]["opentox-dataset"]) + log OpenTox::RestClientWrapper.delete @@config[:services]["opentox-dataset"] log "upload dataset" data = File.read(@@file.path) - data_uri = OpenTox::RestClientWrapper.post @@config[:services]["opentox-dataset"], data, :content_type => "application/rdf+xml" - + task_uri = OpenTox::RestClientWrapper.post @@config[:services]["opentox-dataset"], data, :content_type => "application/rdf+xml" + data_uri = OpenTox::Task.find(task_uri).wait_for_resource + log "train-test-validation" Lib::Validation.auto_migrate! - delete_all(@@config[:services]["opentox-model"]) + #delete_all(@@config[:services]["opentox-model"]) + OpenTox::RestClientWrapper.delete @@config[:services]["opentox-model"] + split_params = Validation::Util.train_test_dataset_split(data_uri, 0.9, 1) v = Validation::Validation.new :training_dataset_uri => split_params[:training_dataset_uri], :test_dataset_uri => split_params[:test_dataset_uri], @@ -121,6 +125,12 @@ class Example end result.gsub!(/\n/, " \\n ") if ($?==0) + if (result.to_s =~ /task/) + log "wait for task: "+result.to_s + task = OpenTox::Task.find(result) + task.wait_for_completion + result = task.resource unless task.failed? + end log "ok ( " +result.to_s[0,50]+" )" suc += 1 else -- cgit v1.2.3