My IronWorker master slave setup results in a rest client 400 error. How do I solve this issue?

StackOverflow https://stackoverflow.com/questions/20491508

  •  30-08-2022
  •  | 
  •  

Question

I am setting up a simple Ironworker Master/Slave worker,

but Iam consistently getting this error

/Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/rest-2.6.3/lib/rest/wrappers/typhoeus_wrapper.rb:66:in `handle_response': HTTP 400 Error. (Rest::HttpError)from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/rest-2.6.3/lib/rest/wrappers/typhoeus_wrapper.rb:74:in `post'

from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/rest-2.6.3/lib/rest/client.rb:195:in `block in post'

from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/rest-2.6.3/lib/rest/client.rb:142:in `perform_op'

from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/rest-2.6.3/lib/rest/client.rb:194:in `post'

from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/iron_core-1.0.1/lib/iron_core/client.rb:192:in `post'

from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/iron_worker_ng-1.0.4/lib/iron_worker_ng/api_client.rb:71:in `tasks_create'

from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/iron_worker_ng-1.0.4/lib/iron_worker_ng/client.rb:282:in `tasks_create'

from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/iron_worker_ng-1.0.4/lib/iron_worker_ng/client.rb:18:in `method_missing'

from /var/folders/lf/gbbgv7mn7_15znyc0m92x3nh0000gn/T/iron-worker-ng-20131209-65715-1wav70r-container/messages_dispatcher.rb:26:in `block in <top (required)>'

from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/activerecord-4.0.0/lib/active_record/relation/delegation.rb:13:in `each'

from /Users/Dan/.rvm/gems/ruby-1.9.3-head@healthberry/gems/activerecord-4.0.0/lib/active_record/relation/delegation.rb:13:in `each'

from /var/folders/lf/gbbgv7mn7_15znyc0m92x3nh0000gn/T/iron-worker-ng-20131209-65715-1wav70r-container/messages_dispatcher.rb:24:in `<top (required)>'

from __runner__.rb:213:in `require'

from __runner__.rb:213:in `<main>'

Here is the code that is producing this error:

Master: *messages_dispatcher.rb*

require 'models/authentication
require 'iron_worker_ng'
require 'active_record'
require 'models/authentication'
require 'models/user'
ActiveRecord::Base.establish_connection('token and secret deleted')

client = IronWorkerNG::Client.new(:token => "token here", :project_id => "project id here")

@auth = Authentication.all

@auth.each do |a|
This line is producing the error
    client.tasks.create("TweetMessagesWorker", user_id: a.user_id)
end

*messages_dispatcher.worker*

runtime "ruby"
gem "pg"
gem "activerecord"
exec "messages_dispatcher.rb"
# Merging models
dir '../app/models/'
full_remote_build true # Or remote

Slave: *messages_worker.rb*

require 'iron_worker_ng'
puts params[:user_id]
# For simplicity I have omitted some code here

*messages_worker.worker*

runtime "ruby"
name 'TweetMessagesWorker'
exec 'messages_worker.rb'
full_remote_build true # Or remote

Has anyone had a similar issue. I equally get an 400 error on the same line if I replace the 'rest' with the 'typheous' gem.

Any help is much appreciated!

Was it helpful?

Solution

Be sure you've uploaded your worker first with codes.create. 400 is usually caused by the code not existing on the server.

The ruby http clients hide the message that's returned right now, I'm going to look into the ruby stuff to ensure the message is displayed properly rather than just the error code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top