diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-01-25 16:27:39 +0100 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-01-25 16:27:39 +0100 |
commit | 2528891633d838a383f5a0e07712a0a8ee839f32 (patch) | |
tree | 6e221f6d0e18d280e8011c7dff16bc1e0581281a /lib/task.rb | |
parent | ddcf8597a13ea6f03c697c78d224376ff36c7ea3 (diff) | |
parent | dbd302164b74de2b241627bcc205de7245ea0da1 (diff) |
merged michas GET authorization
Diffstat (limited to 'lib/task.rb')
-rw-r--r-- | lib/task.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/task.rb b/lib/task.rb index 4d1ee90..3c6aba5 100644 --- a/lib/task.rb +++ b/lib/task.rb @@ -49,12 +49,12 @@ 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 - return task - #raise "Server too busy to start a new task" - end + #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 + # return task + # #raise "Server too busy to start a new task" + #end task_pid = Spork.spork(:logger => LOGGER) do LOGGER.debug "Task #{task.uri} started #{Time.now}" |