Permalink
Browse files

load from yml file - bumped version

  • Loading branch information...
1 parent 08601f4 commit a633c4745a1e14c03025a2c794d3cf1755774b4d @kristianmandrup committed Apr 28, 2012
View
@@ -9,6 +9,13 @@ The `job_counts` is list that is used to define how many jobs are run for the nu
```ruby
HerokuResque::AutoScale.job_counts[2] = 22 # 22 max jobs for 2 workers
HerokuResque::AutoScale.job_counts = [1,4,8,16,32,64]
+
+# load jobcounts list from config/heroku/worker_auto_scale.yml
+HerokuResque::AutoScale.job_counts = HerokuResque::AutoScale::Loader.job_counts
+
+# or configure filename to use before load
+HerokuResque::AutoScale::Loader.file_name = 'job_counts.yml'
+HerokuResque::AutoScale.load_job_counts!
```
## Usage
@@ -30,7 +37,7 @@ You can customize the Heroku stack used like this:
`HerokuStack.name = 'my-stack'`
-We might have to adjust the code in order to support different stacks with different Process models in the future...
+We might have to adjust the code in `scaler.rb`order to support Heroku stacks with different Process models in the future...
## Contributing to heroku-auto_scale
View
@@ -1 +1 @@
-0.1.0
+0.1.1
@@ -0,0 +1 @@
+worker_maxjobs: [1, 15, 25, 40, 60, 100, 150]
View
@@ -1,3 +1,4 @@
require 'heroku'
require 'heroku_resque/auto_scale'
-require 'heroku_stack'
+require 'heroku_resque/rails/engine'
+require 'heroku_stack'
@@ -1,4 +1,5 @@
require 'heroku_resque/auto_scale/scaler'
+require 'heroku_resque/auto_scale/loader'
module HerokuResque
module AutoScale
@@ -12,6 +13,10 @@ def after_perform_scale_down(*args)
class << self
attr_writer :default_config, :job_counts
+ def load_job_counts!
+ self.job_counts = HerokuResque::AutoScale::Loader.job_counts
+ end
+
def job_counts
@job_counts ||= [1, 15, 25, 40, 60, 100, 150]
end
@@ -0,0 +1,22 @@
+require 'yaml'
+
+module HerokuResque
+ module AutoScale
+ module Loader
+ class << self
+ def job_counts
+ @job_counts ||= YAML.open(path)['worker_maxjobs']
+ end
+
+ attr_writer :file_name
+ def file_name
+ @file_name = ||= 'worker_auto_scale.yml'
+ end
+
+ def path
+ Rails.root.join('config', 'heroku', file_name)
+ end
+ end
+ end
+ end
+end
@@ -0,0 +1,6 @@
+module HerokuResque
+ module Rails
+ class Engine < ::Rails::Engine
+ end
+ end
+end

0 comments on commit a633c47

Please sign in to comment.