summaryrefslogtreecommitdiff
path: root/model.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2010-07-14 13:56:50 +0200
committerChristoph Helma <helma@in-silico.ch>2010-07-14 13:56:50 +0200
commitfc0f9e5fa3b521397d2026e649c4873600026838 (patch)
treef5bb033210085328e47ba3acac0c0f6906b30519 /model.rb
parent5eec83b4196c84b32817d045d31b0815db38fb05 (diff)
model creation working, validation report generation fails for large datasets
Diffstat (limited to 'model.rb')
-rw-r--r--model.rb49
1 files changed, 32 insertions, 17 deletions
diff --git a/model.rb b/model.rb
index 6430933..5b68558 100644
--- a/model.rb
+++ b/model.rb
@@ -15,7 +15,11 @@ class ToxCreateModel
property :created_at, DateTime
def status
- RestClient.get(File.join(@task_uri, 'hasStatus')).body
+ #begin
+ RestClient.get(File.join(@task_uri, 'hasStatus')).body
+ #rescue
+ # "Service offline"
+ #end
end
def validation_status
@@ -107,36 +111,47 @@ class ToxCreateModel
def process
- if !@uri and status == "Completed"
- @uri = RestClient.get(File.join(@task_uri, 'resultURI')).body
+ if @uri.nil? and status == "Completed"
+ update :uri => RestClient.get(File.join(@task_uri, 'resultURI')).body
lazar = YAML.load(RestClient.get(@uri, :accept => "application/x-yaml").body)
case lazar.dependentVariables
when /classification/
- @type = "classification"
+ update :type => "classification"
when /regression/
- @type = "regression"
+ update :type => "regression"
else
- @type = "unknown"
+ update :type => "unknown"
end
- save
- end
- if !@validation_uri and validation_status == "Completed"
+ elsif @validation_uri.nil? and validation_status == "Completed"
begin
- @validation_uri = RestClient.get(File.join(@validation_task_uri, 'resultURI')).body
+ update :validation_uri => RestClient.get(File.join(@validation_task_uri, 'resultURI')).body
LOGGER.debug "Validation URI: #{@validation_uri}"
- @validation_report_task_uri = RestClient.post(File.join(@@config[:services]["opentox-validation"],"/report/crossvalidation"), :validation_uris => @validation_uri).body
+ update :validation_report_task_uri => RestClient.post(File.join(@@config[:services]["opentox-validation"],"/report/crossvalidation"), :validation_uris => @validation_uri).body
LOGGER.debug "Validation Report Task URI: #{@validation_report_task_uri}"
- save
rescue
+ LOGGER.warn "Cannot create Validation Report Task #{@validation_report_task_uri} for Validation URI #{@validation_uri} from Task #{@validation_task_uri}"
+ end
+
+ elsif @validation_report_uri.nil? and validation_report_status == "Completed"
+ begin
+ LOGGER.debug File.join(@validation_report_task_uri, 'resultURI')
+ LOGGER.debug "Report URI: "+RestClient.get(File.join(@validation_report_task_uri, 'resultURI')).body
+ update :validation_report_uri => RestClient.get(File.join(@validation_report_task_uri, 'resultURI')).body
+ rescue
+ LOGGER.warn "Cannot create Validation Report for Task URI #{@validation_report_task_uri} "
end
end
- if @validation_report_task_uri and !@validation_report_uri and validation_report_status == 'Completed'
- @validation_report_uri = RestClient.get(File.join(@validation_report_task_uri, 'resultURI')).body
- end
- end
- self
+ #LOGGER.debug self.to_yaml
+ #LOGGER.debug @uri
+ #LOGGER.debug @validation_uri
+ #LOGGER.debug @validation_uri.nil?
+ #LOGGER.debug validation_status
+ #LOGGER.debug self.validation_report_task_uri
+ #LOGGER.debug self.validation_report_uri
+ #self.save
+ end
end