Can someone tell me the best way to make a system call (from within my
model) that runs for a while and requires params form my model,
specifically attributes of my model.
So, I need the correct syntax and also general guidelines for launching
the process.
Don’t fork in your rails app. you will lose the database connection.
Jason
While that may work, it won’t be very happy about it Especially if
you are trying to run a perl script that takes as long as you are
talking about. This is exactly the kind of thing I wrote backgroundrb
[1] for. You should check it out.\
Don’t fork in your rails app. you will lose the database connection.
Jason
While that may work, it won’t be very happy about it Especially if
you are trying to run a perl script that takes as long as you are
talking about. This is exactly the kind of thing I wrote backgroundrb
[1] for. You should check it out.\
I’m definitely going to check out backgroundrb. Wow, looks like a very
good fit for my needs. Quick question, I notice you have methods in a
controller class to handle launching jobs, progress bar, etc. What I
envision is to launch a job and then simply have the job send an email
to a particular address when it completes. Real simple. Are there any
issues with backgroundrb if I want use this approach?
Yeah what you want to do would be no problem. You aren't forced to
use progress bars at all. In fact you can use the plugin like a fire
and forget type of thing. I mean if you just kick it off from your
rails app somewhere, then it can just do its thing and then send the
email. You will want to run a simple cron script that does garbage
collection of old worker instances every so often. The next major
release will introduce a timing mechanism so old workers get garbage
collected automatically. Or you will be able to set a time to live
when you start the worker and it will commit suicide after the time
runs out. There’s ifo abou ll of this stuff in the README as well as
a script you can run from cron.
Cheers-
-Ezra
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.