diff options
author | Christoph Helma <helma@in-silico.ch> | 2010-12-16 16:55:23 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2010-12-16 16:55:23 +0100 |
commit | c923250bccd4023447feb46935f3b59ce5cfb843 (patch) | |
tree | 0a692283d175f0a3f1d4024bc102ce9133ccb2b0 /lib/task.rb | |
parent | 2d692f13d3bd0b894f1ec67c4b860a09de3e746c (diff) | |
parent | b22110ae0d8e902d700e0a3dc629ebfde1edfe10 (diff) |
Merge branch 'development' of https://github.com/rautenberg/opentox-ruby into development
Diffstat (limited to 'lib/task.rb')
-rw-r--r-- | lib/task.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/task.rb b/lib/task.rb index 17f95e6..18fba6e 100644 --- a/lib/task.rb +++ b/lib/task.rb @@ -49,6 +49,7 @@ module OpenTox cpu_load = `cat /proc/loadavg`.split(/\s+/)[0..2].collect{|c| c.to_f} nr_cpu_cores = `cat /proc/cpuinfo |grep "cpu cores"|cut -d ":" -f2|tr -d " "`.split("\n").collect{|c| c.to_i}.inject{|sum,n| sum+n} + nr_cpu_cores = 1 if !nr_cpu_cores if cpu_load[0] > nr_cpu_cores and cpu_load[0] > cpu_load[1] and cpu_load[1] > cpu_load[2] # average CPU load of the last minute is high and CPU load is increasing LOGGER.warn "Cannot start task - CPU load too high (#{cpu_load.join(", ")})" task.cancel |