I've been told by Heroku Support that we need to migrate to the Bamboo stack, upgrade our heroku and rest-client gems to the latest, and this should work. Thanks to this community's help, I should be able to add or subtract workers with just a few lines of code!
add_heroku_worker heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'], ENV['HEROKU_PASSWORD']) heroku.set_workers(ENV['HEROKU_APP'], +1) Thanks, everyone! Jim On Jan 21, 10:07 am, rubynoob <mysmilecent...@gmail.com> wrote: > @Pedro: > > Here's a link to the stack > trace:https://docs.google.com/document/d/1ntWg7PKgyOnSmAVkURW00O5i_LEDFdRsc... > > We're using RestClient gem version 1.4.2 with the Heroku gem version > 1.17.8, FWIW. > > @Chris: That is good to know. So it sounds like I don't need to > introduce a lag as Keenan suggests. > > Thanks, > Jim > > On Jan 21, 9:01 am, Chris Hanks <christopher.m.ha...@gmail.com> wrote: > > > You can start up as many workers (or dynos, for that matter) as you > > want through the command line. 24 is just how high the slider goes on > > the pricing page. > > > On Jan 21, 7:52 am, rubynoob <mysmilecent...@gmail.com> wrote: > > > > I may misunderstand how workers get charged on heroku, but from what > > > I've seen > > > athttp://docs.heroku.com/background-jobsandhttp://docs.heroku.com/delay..., > > > workers get charged $0.05/hr each > > > no matter how many are running, pro-rated to the second. The maximum > > > workers per account seems to be 24 (that's where the slider stops on > > > their Resources page). > > > > The jobs being delayed won't be created faster than one every 30 > > > seconds, so I assumed the first worker would spin up and grab the > > > first job, then when the second job gets queued, a second worker would > > > start, grabbing the second job, and so on. Each job would process in > > > it's own worker, which would then get shut down when the job > > > completes. One worker running three jobs that take a total of fifteen > > > minutes to process should get charged the same as three workers > > > running one job each for five minutes. If I'm mistaken, let me know. > > > > Thanks, > > > Jim > > > > On Jan 20, 4:57 pm, Keenan Brock <kee...@thebrocks.net> wrote: > > > > > Also a thought. > > > > > You will need to introduce a lag when you are determining if you need > > > > more or less delayed job workers. > > > > > Otherwise you will spin up too many DJs too quickly. And add/remove > > > > them very often. Incurring extra charges. > > > > > Smugmug spoke about this when they were talking about their on demand > > > > photo processors a few years back. > > > > > --Keenan > > > > > On Jan 20, 2011, at 6:06 PM, Pedro Belo <pe...@heroku.com> wrote:> That > > > > was a good call, you definitely don't want to store variables in > > > > > config vars. Save if for constants (passwords, urls, etc). > > > > > > It seems like you might be getting an error due to different versions > > > > > of RestClient, not sure though. What version are you using? What's the > > > > > stack trace for the exception? > > > > > > On a side note, if it helps you can call heroku workers passing > > > > > relative values, like +3, -1, etc. > > > > > > On Thu, Jan 20, 2011 at 12:00 PM, rubynoob <mysmilecent...@gmail.com> > > > > > wrote: > > > > >> Instead of storing the count of active workers as a heroku config > > > > >> variable, I decided to create a table in our database to store the > > > > >> value in. > > > > >> So now I've got the problem narrowed down to the last line in the > > > > >> method. Here's the block of code I've now got: > > > > > >> add_heroku_worker > > > > >> heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'], > > > > >> ENV['HEROKU_PASSWORD']) > > > > >> myapp = > > > > >> heroku.config_vars(ENV['HEROKU_APP'])["HEROKU_APP"] > > > > >> worker_count = WorkerCount.find(1) # now I'm storing > > > > >> the current > > > > >> number of active workers in a table that will always only have one > > > > >> record. > > > > >> workers = worker_count.workers > > > > >> qty = workers + 1 > > > > >> worker_count.workers = qty > > > > >> worker_count.save > > > > >> heroku.set_workers(myapp, qty) > > > > >> end > > > > > >> In the heroku console, this runs smoothly until I try the last line, > > > > >> to which I get this error: TypeError: can't convert > > > > >> RestClient::Payload::UrlEncoded into String > > > > > >> This line is formatted the same as LostBoy's workless gem, the > > > > >> autoscaling tree of delayed_job, and Heroku-Delayed-Job-Autoscale. I > > > > >> must be missing something obvious (typical newbie, huh?) ;) > > > > > >> Thanks again for any help, > > > > >> Jim > > > > > >> On Jan 20, 9:16 am, Peter Haza <peter.h...@gmail.com> wrote: > > > > >>> I've done autoscaling of workers > > > > >>> here:https://github.com/phaza/Heroku-Delayed-Job-Autoscale > > > > >>> It's actually more like auto-shutdown of a single workers, but it > > > > >>> works well > > > > >>> in our environment. > > > > > >> -- > > > > >> You received this message because you are subscribed to the Google > > > > >> Groups "Heroku" group. > > > > >> To post to this group, send email to heroku@googlegroups.com. > > > > >> To unsubscribe from this group, send email to > > > > >> heroku+unsubscr...@googlegroups.com. > > > > >> For more options, visit this group > > > > >> athttp://groups.google.com/group/heroku?hl=en. > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > > > Groups "Heroku" group. > > > > > To post to this group, send email to heroku@googlegroups.com. > > > > > To unsubscribe from this group, send email to > > > > > heroku+unsubscr...@googlegroups.com. > > > > > For more options, visit this group > > > > > athttp://groups.google.com/group/heroku?hl=en. -- You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to heroku@googlegroups.com. To unsubscribe from this group, send email to heroku+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.