summaryrefslogtreecommitdiff
path: root/lib/task.rb
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2010-12-14 12:30:20 +0100
committermr <mr@mrautenberg.de>2010-12-14 12:30:20 +0100
commit4c2470353a1e3b69b4260d0052c9c48137ef76d3 (patch)
treef9b0a4dced11c446023b07565066bb0a9de6af27 /lib/task.rb
parentde12a8002ebc0bf4018588deafd5057b6478f414 (diff)
remove token_id from tables in database
Diffstat (limited to 'lib/task.rb')
-rw-r--r--lib/task.rb1
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