I am trying to initiate a background process with several parameters
including a CSV file. Can anyone provide an example where a file is
used as input for the background worker?
Thanks,
Nathan
I am trying to initiate a background process with several parameters
including a CSV file. Can anyone provide an example where a file is
used as input for the background worker?
Thanks,
Nathan
On Oct 16, 2006, at 7:22 PM, Nathan L. wrote:
I am trying to initiate a background process with several parameters
including a CSV file. Can anyone provide an example where a file is
used as input for the background worker?Thanks,
Nathan
Nathan-
I would suggest just sending the filename to the worker and have the
worker open the file and deal with the contents.
– Ezra Z.
– Lead Rails Architect
– [email protected]
– Engine Y., Serious Rails Hosting
– (866) 518-YARD (9273)
Ezra,
Thanks for the tip. The problem was that I was getting that “connection
refused” when trying to open the file for reading. I found that passing
in the file contents as an array works. Just wondering if there is a
better way. I will look for ways around the connection error.
Also, as a follow up (if you don’t mind sharing), what is the preferred
method for ensuring that the background server is started/running at all
times? The environment is Fedora Core 5.
Thanks!
Nathan
On Mon, 2006-10-16 at 22:54 -0400, Nathan L. wrote:
used as input for the background worker?
All,
I got this working using Ezra’s comments and the ‘tempfile’ idea
suggested in “Ruby Cookbook”. Thought there might be others that want
to accomplish similar things. I don’t want to clog the list, so here’s
a summary…
The form handler controller passes the multi-part file data to a temp
file on the server file system, then passes the file dir/name to the
background worker process. The worker re-reads the data and performs
the main work…in this case updating a Postgresql database with about
100k records.
If anyone wants details or code samples, please contact me off list.
Also, if there are suggestions for improvements I could make, please let
me know!
Thanks,
Nathan
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs