Ah, We can put this in FAQ.
2009/3/15 Justin Wood <[email protected]>: > Hi, All > > Appreciate all the assistance, turns out this is a problem resulting from > > Rails <= 2.1.1 and Postgres (to do with the way binary fields are escaped) > > I upgraded Rails and it works. > > Thanks > Justin > > On Sat, Mar 14, 2009 at 11:07 AM, Justin Wood <[email protected]> > wrote: >> >> Hi, Hemant >> >> Ah ok. Found out where it was making the call in in meta_worker and saw >> the args coming back nil from load_data. So I ran this in IRB >> >> >> job=BdrbJobQueue.find(:first,:conditions => [" worker_name = ? AND >> >> taken = ? AND scheduled_at <= ? ", "notification_worker", 0, Time.now.utc >> >> ]) >> => #<BdrbJobQueue id: 53, args: "\\004\\010\"\\011asdf", worker_name: >> "notification_worker", worker_method: "asdf", job_key: "Fri Mar 13 16:14:48 >> +1300 2009", taken: 0, finished: 0, timeout: nil, priority: nil, >> submitted_at: "2009-03-13 03:14:48", started_at: nil, finished_at: nil, >> archived_at: nil, tag: nil, submitter_info: nil, runner_info: nil, >> worker_key: "", scheduled_at: "2009-03-13 03:14:51"> >> >> job.args >> => "\\004\\010\"\\011asdf" >> >> Marshal.load(job.args) >> TypeError: incompatible marshal file format (can't be read) >> format version 4.8 required; 92.48 given >> from (irb):10:in `load' >> from (irb):10 >> >> So the problem is with marshalling ... double checked that by putting a >> logger statement into BdrbServerHelper's load_data like so: >> >> ... >> rescue >> error_msg = $!.message >> logger.error("Error marshaling data: #{data} #{error_msg}) >> #added >> if error_msg =~ /^undefined\ .+\ ([A-Z].+)/ >> .... >> >> and got the same error message. Having something going to the log in the >> rescue there would be a useful addition. >> >> I'm using Postgres 8.3.1 (database in utf8) on Ubuntu found someone else >> that encountered a marshalling error here: >> >> http://blade.nagaokaut.ac.jp/ruby/ruby-talk/116099 >> >> Looks like a ruby/Postgres issue? I'll have a look see if I can sort >> this out but any advice you could give me would be much appreciated. >> >> Thanks >> Justin >> >> >> On Fri, Mar 13, 2009 at 8:58 PM, hemant <[email protected]> wrote: >>> >>> On Fri, Mar 13, 2009 at 11:57 AM, Justin Wood >>> <[email protected]> wrote: >>> > Hi, Samer >>> > >>> > Thanks for the quick reply. I changed things a bit and ran this >>> > >>> >>> >>> >>> >>> >>> MiddleMan.new_worker(:worker=>:notification_worker,:worker_key=>'testkey',:data=>"data >>> >>> arguement") >>> > => "testkey" >>> >>> >>> >>> >>> >>> MiddleMan.worker(:notification_worker,'testkey').enq_send_warranty_notice(:job_key=>Time.now.to_s,:arg >>> >>> => "asdf",:scheduled_at => Time.now + 3.second) >>> > => true >>> > >>> > ... but the arg is still not being passed. >>> > >>> > My understanding of new_worker is it explictly creates a worker for you >>> > that >>> > you can refer to by the key, so >>> > >>> > If I do this: >>> > >>> > MiddleMan.worker(:notification_worker,'testkey') >>> > >>> > I'm getting the worker I created above but when I call this: >>> > >>> > MiddleMan.worker(:notification_worker) >>> > >>> > I'm getting the default worker that was created at startup. >>> > >>> > Regardless of how the worker is created the "arg" parameter is still >>> > not >>> > being passed when it gets invoked to do enqued work. Going through >>> > the >>> > code ... I can't figure out how it gets invoked. >>> > >>> >>> Well whatever you pass to enq_xxx method gets marshalled to database >>> and gets unmarshalled from table when the task is scheduled inside >>> worker. Can you paste your worker code? >> > > > _______________________________________________ > Backgroundrb-devel mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/backgroundrb-devel > -- 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 _______________________________________________ Backgroundrb-devel mailing list [email protected] http://rubyforge.org/mailman/listinfo/backgroundrb-devel
