Method: Heroku::Command::Ps#scale

Defined in:
lib/heroku/command/ps.rb

#scaleObject

ps:scale DYNO1=AMOUNT1 [DYNO2=AMOUNT2 …]

scale dynos by the given amount

Examples:

$ pogo ps:scale web=3 worker+1 Scaling web dynos… done, now running 3 Scaling worker dynos… done, now running 1



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/heroku/command/ps.rb', line 177

def scale
  changes = {}
  args.each do |arg|
    if arg =~ /^([a-zA-Z0-9_]+)([=+-]\d+)$/
      changes[$1] = $2
    end
  end

  if changes.empty?
    error("Usage: pogo ps:scale DYNO1=AMOUNT1 [DYNO2=AMOUNT2 ...]\nMust specify DYNO and AMOUNT to scale.")
  end

  changes.keys.sort.each do |dyno|
    amount = changes[dyno]
    action("Scaling #{dyno} dynos") do
      amount.gsub!("=", "")
      new_qty = api.post_ps_scale(app, dyno, amount).body
      status("now running #{new_qty}")
    end
  end
end