Does anyone know of a background job manager that works with Rails 3? I have heard of Starling and Workling but I do not see a fork for Rails 3.
I used this article to get delayed_job (a common rails 2 gem for queueing jobs to be done later) running on rails 3. The collectiveidea branch of delayed_job has rails 3 support and works great.
Are you looking for a background-job worker ?
for simple usage i suggest delayed_job
https://github.com/collectiveidea/delayed_job/
Resque instead is more powerfull (It's used for github background job) but complicated.
https://github.com/defunkt/resque
bye
take a look at the railscast: beanstalkd and stalker: http://railscasts.com/episodes/243-beanstalkd-and-stalker
spawn is fine if you just want to run some code in a seperate thread and just forget about it.
https://github.com/tra/spawn
Related
I´m using Rufus Scheduler 3.0.3 in a Ruby on Rails 4.1.4 web app and it´s working great with Unicorn. I moved to Puma and it´s great but I have realized Rufus is not working with Puma (daemonized).
I have read this issue #183 (comment) https://github.com/puma/puma/issues/183#issuecomment-59386038 that is closed for an earlier version, but it´s still not working and not clear to me if there is already a fix for it.
I don´t know if there is a workaround in the meantime.
UPDATE: There are not much logs to display, my rufus scheduler tasks are working when running with Unicorn, but If I change the server to Puma, it doesn´t run any automated task on my laptop. Even there is not any log to show.
I just add my current Rufus scheduler file:
task_scheduler.rb:
begin
require 'rufus-scheduler'
scheduler = Rufus::Scheduler.new
#Secretary responsible for executing events every 60 seconds.
scheduler.every '60s' do
Secretary.executeEvents
end
# Statistics (Owner) calculation every 1 day.
scheduler.every '24h' do
StatisticsCalculator.updateOwnerStatistics
end
end
Am I missing any configuration?
On the Puma side, I just have this config file config/puma/development.rb with only this:
stdout_redirect 'log/puma.stdout.log', 'log/puma.stderr.log', true
I don´t set up any workers, etc...
No, it works.
I packaged this sample project for you:
https://github.com/jmettraux/for_rober
Rufus-scheduler 3.0.3 schedules just fine with Puma 2.9.2 (Ruby 1.9.3 on Debian GNU/Linux).
Thanks for not blaming other people's work without facts.
If there really is an issue, I suggest you go and read http://www.chiark.greenend.org.uk/~sgtatham/bugs.html, then read it again, three times. It's most surely available in your native language. Then, if you really think rufus-scheduler is the culprit, go and open a detailed issue report at https://github.com/jmettraux/rufus-scheduler/issues Beware posting crappy "it doesn't work" material, it'll earn you only negative reactions.
UPDATE:
I strongly suggest you clone my mini-project on your machine and try it, then report the results here in the comments. The details are in the README.md of the project.
UPDATE:
Roberto is trying to get this issue solved in parallel, directly at https://github.com/puma/puma/issues/607
Finally, it looks there was an small issue. It has been kindly fixed by the Puma guys.
Please, see:
https://github.com/puma/puma/issues/607
I've recently discovered Zeus and it's fantastic really speeds up my feedback loop when developing it's just that when I'm making changes to my model like adding a new method Zeus doesn't restart and the new method isn't loaded.
I'm not sure where to start debugging but I'm using Rails 4.0.2, ruby 2.0.0p353 and Rspec + Capybara for testing.
Anyone have any ideas or help that would be fantastic.
Thanks a lot
If you are using unicorn this could be your problem. Try using thin instead
Zeus:
Reloads models correctly when modifying callbacks and scopes, which
is not always the case for servers with hot-reload, such as Unicorn.
It also reloads views when writing integration specs.(source)
You may also need to reconfigure foreman. Check this thread for information on foreman support with Zeus: https://github.com/burke/zeus/issues/92
I need somekind of a callback for a function to be caled in 5 min after the create-method.
My situation:
The user logs in in my web-page, uploads some files (create-method is invoked), in 5 min should the files be on their way to be analyzed(in 5 min it should call the method, which just take the whole folder, where the files are stored and analysis it). That is why such things like typing rake jobs:work or using gem daemons and typing "RAILS_ENV=production script/delayed_job start" in the command line does not suit me.
I want to start my apllication as usual with rails s, log in, upload the files and it should work automatically that the files are analyzed.
As I understood once the jobs started they will continue run? I do not need this. I need just some methods run in 5 min after create method.
All this stuff with gem 'delayed_job_active_record' to qeue the jobs and daemons to start the workers seem too complicted for such an easy task.
So, is it possible using gem 'delayed_job_active_record' and gem daemons to start my application with rails s and everythings will be done automatically in background without me stopping an application and typing things in the commanline to run the delayed jobs?
Or is it possible to do without all thise complicated stuff?
I have already asked about delayed_jobs here and here.
Many thanks in advance.
Here is a post where it is described how to set up scheduling with delayedjob
Update 2015-07-06: link's broken and I can't find a cached version - see update below
If you can, I recommend looking into sidekiq which is a great message queue and even has built in scheduling. It does use redis though, so unless you already have redis deployed it will be a tiny bit of work.
Update
Here is a gist with a simple solution to scheduled and recurring jobs with delayedjob
I'm looking for a tool or gem or something to allow me to run ruby methods every certain time.
I've tried many ways to do this like backgroundRB, whenever and starling and workling, the main problem is that we have to automate the tasks in Windows 7, we can't use cron.
BackgroundRB is not being updated, so we can't install it in ROR 3.0.3 or 3.0.9
What I need to do is to monit an event, using rake from the outside takes too long to load and will produce a timeout in a secondary system, so i need to run the methods from the 'inside' without loading all the environment every time.
There are many articles about this, but most of them are not updated, so I need a current suggestion, thanks in advance
Why not use the built in Windows Task Scheduler and batch or VBScripts? Even powershell could work.
I've been using collectiveidea's fork of delayed_job as a gem in my Rails 3 app, and it's working fine. I'm now looking for a solution to autoscale workers, specifically for Heroku. I've given pedro's fork a try but since it's written for Rails 2, using it throws lots of errors and warnings about deprecated methods and I haven't been able to get it to work successfully.
Is there a working solution for Rails 3 delayed_job with autoscaling workers?
You might want to take a look at workless, it's one of the only Rails3 worker autoscalers I've seen at this point.
Specifically for heroku, check out "HireFire - The Heroku Worker Manager" and hirefireapp service:
https://github.com/meskyanichi/hirefire - open source
http://hirefireapp.com/ - service in public beta now
I've started working on a gem called Komodo to perform that very same task for un upcoming project at work. However, since we've only just started on the project, the gem is still very, very early - and untested.
I should see some consistent updating over the next couple of weeks though - would certainly appreciate any feedback or contributions! :)