Rake resque: failing with simple example

I wanted to start with resque. So I created three files, one to create a dummy job and two others to process it:

    --- image_transformer.rb ---
    # coding: UTF-8
    class ImageTransformer
      @queue = 'image_transform_queue'

      def self.perform (asset_id)
        puts "perform"
        puts asset_id
      end
    end

    --- create_job.rb ---
    # coding: UTF-8
    require 'resque'
    require_relative 'image_transformer'

    Resque.enqueue (ImageTransformer, 'test')

    --- Rakefile ---
    # coding: UTF-8
    require_relative 'image_transformer'
    require 'resque / tasks'

Then I first run $ ruby ​​create_job.rb with no problem. I see work in the resque queue.

Now I want to start a worker, but that fails:

    $ QUEUE = * VVERBOSE = 1 VERBOSE = 1 rake resque: work --trace
    ** Invoke resque: work (first_time)
    ** Invoke resque: preload (first_time)
    ** Invoke resque: setup (first_time)
    ** Execute resque: setup
    ** Execute resque: preload
    ** Invoke resque: setup
    ** Execute resque: work
    *** Starting worker anpr-THINK: 15292: *
    Signals QUIT, USR1, USR2, and / or CONT not supported.
    *** Registered signals
    *** Checking content_download
    *** Checking image_transform_queue
    *** Found job on image_transform_queue
    *** got: (Job {image_transform_queue} | ImageTransformer | ["test"])
    rake aborted!
    "\ xE4" on US-ASCII
    c: /ruby193/lib/ruby/gems/1.9.1/gems/multi_json-1.2.0/lib/multi_json/engines/json
    _common.rb: 13: in `encode '
    c: /ruby193/lib/ruby/gems/1.9.1/gems/multi_json-1.2.0/lib/multi_json/engines/json
    _common.rb: 13: in `to_json '
    c: /ruby193/lib/ruby/gems/1.9.1/gems/multi_json-1.2.0/lib/multi_json/engines/json
    _common.rb: 13: in `encode '
    c: /ruby193/lib/ruby/gems/1.9.1/gems/multi_json-1.2.0/lib/multi_json.rb: 88: in `en
    code '
    c: /ruby193/lib/ruby/gems/1.9.1/gems/resque-1.20.0/lib/resque/helpers.rb: 22: in `e
    ncode '
    c: /ruby193/lib/ruby/gems/1.9.1/gems/resque-1.20.0/lib/resque/worker.rb: 396: in `w
    orking_on '
    c: /ruby193/lib/ruby/gems/1.9.1/gems/resque-1.20.0/lib/resque/worker.rb: 133: in `b
    lock in work '
    c: /ruby193/lib/ruby/gems/1.9.1/gems/resque-1.20.0/lib/resque/worker.rb: 126: in `l
    oop '
    c: /ruby193/lib/ruby/gems/1.9.1/gems/resque-1.20.0/lib/resque/worker.rb: 126: in `w
    ork '
    c: /ruby193/lib/ruby/gems/1.9.1/gems/resque-1.20.0/lib/resque/tasks.rb: 34: in `blo
    ck (2 levels) in '
    c: /ruby193/lib/ruby/1.9.1/rake/task.rb: 205: in `call '
    c: /ruby193/lib/ruby/1.9.1/rake/task.rb: 205: in `block in execute '
    c: /ruby193/lib/ruby/1.9.1/rake/task.rb: 200: in `each '
    c: /ruby193/lib/ruby/1.9.1/rake/task.rb: 200: in `execute '
    c: /ruby193/lib/ruby/1.9.1/rake/task.rb: 158: in `block in invoke_with_call_chain '
    c: /ruby193/lib/ruby/1.9.1/monitor.rb: 211: in `mon_synchronize '
    c: /ruby193/lib/ruby/1.9.1/rake/task.rb: 151: in `invoke_with_call_chain '
    c: /ruby193/lib/ruby/1.9.1/rake/task.rb: 144: in `invoke '
    c: /ruby193/lib/ruby/1.9.1/rake/application.rb: 116: in `invoke_task '
    c: /ruby193/lib/ruby/1.9.1/rake/application.rb: 94: in `block (2 levels) in top_lev
    el '
    c: /ruby193/lib/ruby/1.9.1/rake/application.rb: 94: in `each '
    c: /ruby193/lib/ruby/1.9.1/rake/application.rb: 94: in `block in top_level '
    c: /ruby193/lib/ruby/1.9.1/rake/application.rb: 133: in `standard_exception_handlin
    g '
    c: /ruby193/lib/ruby/1.9.1/rake/application.rb: 88: in `top_level '
    c: /ruby193/lib/ruby/1.9.1/rake/application.rb: 66: in `block in run '
    c: /ruby193/lib/ruby/1.9.1/rake/application.rb: 133: in `standard_exception_handlin
    g '
    c: /ruby193/lib/ruby/1.9.1/rake/application.rb: 63: in `run '
    c: / ruby193 / bin / rake: 32: in `'
    Tasks: TOP => resque: work

Does anyone know what's going on? It looks like an encoding problem, but where?

I am using Windows 7 (if needed).

EDIT: I have pasted the debug output into the "#encode" method: {: queue => "image_transform_queue" ,: run_at => "2012/03/28 13:25:53 Mitteleurop \ xE4i sche Sommerzeit",: payload => {" class "=>" ImageTransformer "," args "=> [" test "]}}

Apparently the problem is that the ": run_at" value contains a German umlaut (that's my locale).

+3


source to share


1 answer


To get this from an unanswered list:


I pasted the debug output into the '#encode' method:



{
    :queue=>"image_transform_queue",
    :run_at=>"2012/03/28 13:25:53 Mitteleurop\xE4i sche Sommerzeit",
    :payload=>{"class"=>"ImageTransformer", "args"=>["test"]}
}

      

Apparently the problem is that the value :run_at

contains a German umlaut (that's my locale).

0


source







All Articles