0

我正在设置一个简单的 Ironworker Master/Slave worker,

但我一直收到这个错误

/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>'

这是产生此错误的代码:

大师: *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

从站: *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

有没有人遇到过类似的问题。如果我将 'rest' 替换为 'typheous' gem,我同样会在同一行出现 400 错误。

任何帮助深表感谢!

4

1 回答 1

0

确保您首先使用codes.create. 400 通常是由服务器上不存在的代码引起的。

ruby http 客户端隐藏了现在返回的消息,我将研究 ruby​​ 内容以确保正确显示消息而不仅仅是错误代码。

于 2013-12-10T22:00:12.920 回答