hi, i want to upload and convert video using backgroundrb. In my case everything is fine, but i dont understand why my controller is waiting for worker to be done? if i use this method success = system("#{FFMPEG} -i #{video_file} -s 320x240 -ar 22050 {video_file}.flv") my controller is waiting for worker to be done. but if i use this method success = IO.popen("ffmpeg -i #{video_file} -ab 32k -ar 22050 -s 320x240 #{video_file}.flv") controller dont waiting for worker. But then i dont have any feedback about converting status. Can someone explain me what im doing wrong or how can i do best ? thank you sergej -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
seems my controller is waiting worker to be done, whatever action it does. my controller look like this: session[:job_key] = MiddleMan.new_worker(:worker => :upload_handler_worker, :job_key => @multimedia_ad.id.to_s) MiddleMan.send_request(:worker => :upload_handler_worker, :worker_method => :upload_video, :data => @multimedia_ad.id, :job_key => session[:job_key]) what am i doing wrong? sine serz wrote:> hi, > > i want to upload and convert video using backgroundrb. > > In my case everything is fine, but i dont understand why my controller > is waiting for worker to be done? > > if i use this method > success = system("#{FFMPEG} -i #{video_file} -s 320x240 -ar 22050 > {video_file}.flv") > my controller is waiting for worker to be done. > > but if i use this method > success = IO.popen("ffmpeg -i #{video_file} -ab 32k -ar 22050 -s 320x240 > #{video_file}.flv") > > controller dont waiting for worker. > > But then i dont have any feedback about converting status. > > > Can someone explain me what im doing wrong or how can i do best ? > > > thank you > > > sergej-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Probably not the source of your problem but I can tell you are not using the newest version of backgroundrb by your syntax. The new version goes from this MiddleMan.send_request(:worker => :upload_handler_worker, :worker_method => :upload_video, :data => @multimedia_ad.id, :job_key => session[:job_key]) to: MiddleMan.worker(:upload_handler_worker, session[:job_key]).upload_video(@multimedia_ad.id) In my opinion, a far superior syntax. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Mar 25, 2008 at 6:10 PM, Nathan Esquenazi <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Probably not the source of your problem but I can tell you are not using > the newest version of backgroundrb by your syntax. The new version goes > from this > > > MiddleMan.send_request(:worker => :upload_handler_worker, :worker_method > => :upload_video, :data => @multimedia_ad.id, :job_key => > session[:job_key])When you are using send_request to send task to worker, you are asking that I will wait for results back no matter how much time it takes. You shouldn''t use send_request, its blocking in nature. You should rather use ask_work> > to: > > MiddleMan.worker(:upload_handler_worker, > session[:job_key]).upload_video(@multimedia_ad.id) > > In my opinion, a far superior syntax.100%, above method is also non blocking in nature, so you can use it too!> > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Let them talk of their oriental summer climes of everlasting conservatories; give me the privilege of making my own summer with my own coals. http://gnufied.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Hemant, It is working now. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I think I am mostly set up but I seem to be failing to get evidence that it works... class QmManualEnchiladaWorker < BackgrounDRb::MetaWorker set_worker_name :qm_manual_enchilada_worker def create(args = nil) # this method is called, when worker is loaded for the first time end def build_QM_Manual_pdf system(''touch backgroundrb_test'') my_test = Time.now.strftime("%m/%d/%Y") my_test end end and in console... MiddleMan.worker(:qm_manual_enchilada_worker).build_QM_Manual_pdf {:worker=>:qm_manual_enchilada_worker, :worker_method=>:build_QM_Manual_pdf, :type=>:do_work} => nil no result, no file backgroundrb server is indeed running on port 11006 $ ps aux|grep backgroundrb craig 17389 1.0 2.6 42764 27300 pts/3 S 10:24 0:05 ruby script/backgroundrb start $ netstat -an |grep 11006 tcp 0 0 0.0.0.0:11006 0.0.0.0:* LISTEN tcp 1 0 127.0.0.1:33764 127.0.0.1:11006 CLOSE_WAIT tcp 0 0 127.0.0.1:11006 127.0.0.1:53379 ESTABLISHED tcp 1 0 127.0.0.1:33766 127.0.0.1:11006 CLOSE_WAIT tcp 0 0 127.0.0.1:53379 127.0.0.1:11006 ESTABLISHED tcp 1 0 127.0.0.1:33765 127.0.0.1:11006 CLOSE_WAIT Need someone to toss me a bone here... Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I think I am mostly set up but I seem to be failing to get evidence that it works... class QmManualEnchiladaWorker < BackgrounDRb::MetaWorker set_worker_name :qm_manual_enchilada_worker def create(args = nil) # this method is called, when worker is loaded for the first time end def build_QM_Manual_pdf system(''touch backgroundrb_test'') my_test = Time.now.strftime("%m/%d/%Y") my_test end end and in console... MiddleMan.worker(:qm_manual_enchilada_worker).build_QM_Manual_pdf {:worker=>:qm_manual_enchilada_worker, :worker_method=>:build_QM_Manual_pdf, :type=>:do_work} => nil no result, no file backgroundrb server is indeed running on port 11006 $ ps aux|grep backgroundrb craig 17389 1.0 2.6 42764 27300 pts/3 S 10:24 0:05 ruby script/backgroundrb start $ netstat -an |grep 11006 tcp 0 0 0.0.0.0:11006 0.0.0.0:* LISTEN tcp 1 0 127.0.0.1:33764 127.0.0.1:11006 CLOSE_WAIT tcp 0 0 127.0.0.1:11006 127.0.0.1:53379 ESTABLISHED tcp 1 0 127.0.0.1:33766 127.0.0.1:11006 CLOSE_WAIT tcp 0 0 127.0.0.1:53379 127.0.0.1:11006 ESTABLISHED tcp 1 0 127.0.0.1:33765 127.0.0.1:11006 CLOSE_WAIT Need someone to toss me a bone here... Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ignore this...I learned you have to restart backgroundrb each time you change a worker script, even in development. On Tue, 2008-04-08 at 10:56 -0700, Craig White wrote:> I think I am mostly set up but I seem to be failing to get evidence > that it works... > > class QmManualEnchiladaWorker < BackgrounDRb::MetaWorker > set_worker_name :qm_manual_enchilada_worker > def create(args = nil) > # this method is called, when worker is loaded for the first time > end > > def build_QM_Manual_pdf > system(''touch backgroundrb_test'') > my_test = Time.now.strftime("%m/%d/%Y") > my_test > end > end > > and in console... > > MiddleMan.worker(:qm_manual_enchilada_worker).build_QM_Manual_pdf > {:worker=>:qm_manual_enchilada_worker, :worker_method=>:build_QM_Manual_pdf, :type=>:do_work} > => nil > > no result, no file > > backgroundrb server is indeed running on port 11006 > $ ps aux|grep backgroundrb > craig 17389 1.0 2.6 42764 27300 pts/3 S 10:24 0:05 ruby > script/backgroundrb start > > $ netstat -an |grep 11006 > tcp 0 0 0.0.0.0:11006 0.0.0.0:* > LISTEN > tcp 1 0 127.0.0.1:33764 127.0.0.1:11006 > CLOSE_WAIT > tcp 0 0 127.0.0.1:11006 127.0.0.1:53379 > ESTABLISHED > tcp 1 0 127.0.0.1:33766 127.0.0.1:11006 > CLOSE_WAIT > tcp 0 0 127.0.0.1:53379 127.0.0.1:11006 > ESTABLISHED > tcp 1 0 127.0.0.1:33765 127.0.0.1:11006 > CLOSE_WAIT > > Need someone to toss me a bone here... > > Craig > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---