diff options
author | mguetlein <martin.guetlein@gmail.com> | 2012-06-12 20:10:07 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2012-06-12 20:10:07 +0200 |
commit | af9354a8a10c1fda8e11006fca0574b0eb5e51e6 (patch) | |
tree | c59f19d35a56e8701766962e02ca8441f776cd79 | |
parent | 826acfb96e310e0d431a56b7c0b3f5408ba2cc5f (diff) |
add/adjust/remove log messages
-rw-r--r-- | lib/algorithm.rb | 2 | ||||
-rw-r--r-- | lib/authorization.rb | 2 | ||||
-rw-r--r-- | lib/model.rb | 2 | ||||
-rw-r--r-- | lib/r-util.rb | 25 | ||||
-rw-r--r-- | lib/spork.rb | 6 | ||||
-rw-r--r-- | lib/task.rb | 6 |
6 files changed, 30 insertions, 13 deletions
diff --git a/lib/algorithm.rb b/lib/algorithm.rb index b921b9c..37c7931 100644 --- a/lib/algorithm.rb +++ b/lib/algorithm.rb @@ -20,7 +20,7 @@ module OpenTox # @param [optional,OpenTox::Task] waiting_task (can be a OpenTox::Subtask as well), progress is updated accordingly # @return [String] URI of new resource (dataset, model, ...) def run(params=nil, waiting_task=nil) - LOGGER.info "Running algorithm '"+@uri.to_s+"' with params: "+params.inspect + LOGGER.debug "Running algorithm '"+@uri.to_s+"' with params: "+params.inspect RestClientWrapper.post(@uri, params, {:accept => 'text/uri-list'}, waiting_task).to_s end diff --git a/lib/authorization.rb b/lib/authorization.rb index a9744e9..ecb78b3 100644 --- a/lib/authorization.rb +++ b/lib/authorization.rb @@ -306,7 +306,7 @@ module OpenTox def self.check_policy(uri, subjectid) return true unless uri and subjectid token_valid = OpenTox::Authorization.is_token_valid(subjectid) - LOGGER.debug "OpenTox::Authorization.check_policy with uri: #{uri}, subjectid: #{subjectid} is valid: #{token_valid}" + #LOGGER.debug "OpenTox::Authorization.check_policy with uri: #{uri}, subjectid: #{subjectid} is valid: #{token_valid}" # check if subjectid is valid unless token_valid # abort if invalid diff --git a/lib/model.rb b/lib/model.rb index c9d367e..cab1b4c 100644 --- a/lib/model.rb +++ b/lib/model.rb @@ -16,7 +16,7 @@ module OpenTox accept_header = 'application/rdf+xml' end end - LOGGER.info "running model "+@uri.to_s+", params: "+params.inspect+", accept: "+accept_header.to_s + LOGGER.debug "running model "+@uri.to_s+", params: "+params.inspect+", accept: "+accept_header.to_s RestClientWrapper.post(@uri,params,{:accept => accept_header},waiting_task).to_s end diff --git a/lib/r-util.rb b/lib/r-util.rb index 463a145..f9591d5 100644 --- a/lib/r-util.rb +++ b/lib/r-util.rb @@ -326,6 +326,8 @@ module OpenTox end end + #LOGGER.debug "converting to array" + # values into 2D array, then to dataframe d_values = [] dataset.compounds.each do |c| @@ -345,14 +347,24 @@ module OpenTox d_values << c_values end end + + #LOGGER.debug "assigning" + df_name = "df_#{dataset.uri.split("/")[-1].split("?")[0]}" assign_dataframe(df_name,d_values,compound_names,features) + #LOGGER.debug "setting types" + # set dataframe column types accordingly f_count = 1 #R starts at 1 features.each do |f| - feat = OpenTox::Feature.find(f,subjectid) - nominal = feat.metadata[RDF.type].to_a.flatten.include?(OT.NominalFeature) + type = dataset.features[f][RDF.type] + unless type + LOGGER.debug "derive feature type by rest-call" + feat = OpenTox::Feature.find(f,subjectid) + type = feat.metadata[RDF.type] + end + nominal = type.to_a.flatten.include?(OT.NominalFeature) if nominal @r.eval "#{df_name}[,#{f_count}] <- as.character(#{df_name}[,#{f_count}])" else @@ -388,8 +400,13 @@ module OpenTox compounds.size.times{|i| dataset.add_compound(compounds[i]) if compound_indices==nil or compound_indices.include?(i)} features.each{|f| dataset.add_feature(f,@@feats[df][f])} features.size.times do |c| - feat = OpenTox::Feature.find(features[c],subjectid) - nominal = feat.metadata[RDF.type].to_a.flatten.include?(OT.NominalFeature) + type = @@feats[df][features[c]][RDF.type] + unless type + LOGGER.debug "derive feature type by rest-call" + feat = OpenTox::Feature.find(features[c],subjectid) + type = feat.metadata[RDF.type] + end + nominal = type.to_a.flatten.include?(OT.NominalFeature) compounds.size.times do |r| if compound_indices==nil or compound_indices.include?(r) dataset.add(compounds[r],features[c],nominal ? values[r][c] : values[r][c].to_f) if values[r][c]!="NA" diff --git a/lib/spork.rb b/lib/spork.rb index c77b5b5..40b78ed 100644 --- a/lib/spork.rb +++ b/lib/spork.rb @@ -36,12 +36,12 @@ module Spork # :no_detach => true if you want to keep the child process under the parent control. usually you do NOT want this def self.spork(options={}) logger = options[:logger] - logger.debug "spork> parent PID = #{Process.pid}" if logger + #logger.debug "spork> parent PID = #{Process.pid}" if logger child = fork do begin start = Time.now - logger.debug "spork> child PID = #{Process.pid}" if logger + #logger.debug "spork> child PID = #{Process.pid}" if logger # set the nice priority if needed Process.setpriority(Process::PRIO_PROCESS, 0, options[:priority]) if options[:priority] @@ -56,7 +56,7 @@ module Spork #raise ex logger.error "spork> Exception in child[#{Process.pid}] - #{ex.class}: #{ex.message}" if logger ensure - logger.info "spork> child[#{Process.pid}] took #{Time.now - start} sec" if logger + #logger.info "spork> child[#{Process.pid}] took #{Time.now - start} sec" if logger # this form of exit doesn't call at_exit handlers exit!(0) end diff --git a/lib/task.rb b/lib/task.rb index d8f0ba6..86d3d5f 100644 --- a/lib/task.rb +++ b/lib/task.rb @@ -72,7 +72,7 @@ module OpenTox end end task.pid = task_pid - LOGGER.debug "Started task: "+task.uri.to_s + #LOGGER.debug "Started task: "+task.uri.to_s task end @@ -248,7 +248,7 @@ module OpenTox due_to_time = Time.new + DEFAULT_TASK_MAX_DURATION start_time = Time.new dur = 0 - LOGGER.debug "start waiting for task "+@uri.to_s+" at: "+Time.new.to_s+", waiting at least until "+due_to_time.to_s + LOGGER.debug "start waiting for task "+@uri.to_s.chomp+" at: "+Time.new.to_s+", waiting at least until "+due_to_time.to_s load_metadata # for extremely fast tasks check_state @@ -265,7 +265,7 @@ module OpenTox end end waiting_task.waiting_for(nil) if waiting_task - LOGGER.debug "Task '"+@metadata[OT.hasStatus].to_s+"': "+@uri.to_s+", Result: "+@metadata[OT.resultURI].to_s + LOGGER.debug "Task '"+@metadata[OT.hasStatus].to_s+"': "+@uri.to_s.chomp+", Result: "+@metadata[OT.resultURI].to_s end # updates percentageCompleted value (can only be increased) |