diff options
author | Christoph Helma <helma@in-silico.ch> | 2011-05-20 13:26:06 +0000 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2011-05-20 13:26:06 +0000 |
commit | 4f7bd464f0676c2cebdcd8a46c1ac79c4ec86cde (patch) | |
tree | c16d874de086ee46700343a3dd985389a4b08ac1 | |
parent | 8c78bf2358338cf5f795a65c9b1c21a48474169f (diff) | |
parent | 41851663e591433fec1b021b88aa77a8fb0d37b0 (diff) |
Merge branch 'master' into development
Conflicts:
lib/algorithm.rb
lib/helper.rb
-rw-r--r-- | lib/dataset.rb | 10 | ||||
-rw-r--r-- | lib/task.rb | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/dataset.rb b/lib/dataset.rb index 2b5759e..4005c1c 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -74,7 +74,7 @@ module OpenTox # @param [optional,String] uri URI of the dataset service, defaults to service specified in configuration # @return [Array] Array of dataset object without data (use one of the load_* methods to pull data from the server) def self.all(uri=CONFIG[:services]["opentox-dataset"], subjectid=nil) - RestClientWrapper.get(uri,{:accept => "text/uri-list",:subjectid => subjectid}).to_s.each_line.collect{|u| Dataset.new(u, subjectid)} + RestClientWrapper.get(uri,{:accept => "text/uri-list",:subjectid => subjectid}).to_s.each_line.collect{|u| Dataset.new(u.chomp, subjectid)} end # Load YAML representation into the dataset @@ -158,8 +158,12 @@ module OpenTox # Load and return only features from the dataset service # @return [Hash] Features of the dataset def load_features(subjectid=nil) - parser = Parser::Owl::Dataset.new(@uri, subjectid) - @features = parser.load_features(subjectid) + if (CONFIG[:yaml_hosts].include?(URI.parse(@uri).host)) + @features = YAML.load(RestClientWrapper.get(File.join(@uri,"features"), {:accept => "application/x-yaml", :subjectid => subjectid})) + else + parser = Parser::Owl::Dataset.new(@uri, subjectid) + @features = parser.load_features(subjectid) + end @features end diff --git a/lib/task.rb b/lib/task.rb index 19f42d6..42d3d17 100644 --- a/lib/task.rb +++ b/lib/task.rb @@ -38,6 +38,7 @@ module OpenTox task = Task.new(task_uri.chomp) # measure current memory consumption +=begin memory = `free -m|sed -n '2p'`.split free_memory = memory[3].to_i + memory[6].to_i # include cache if free_memory < 20 # require at least 200 M free memory @@ -56,6 +57,7 @@ module OpenTox # return task # #raise "Server too busy to start a new task" #end +=end task_pid = Spork.spork(:logger => LOGGER) do LOGGER.debug "Task #{task.uri} started #{Time.now}" |