lib/cloud_crowd/models/node_record.rb
# Dispatch a WorkUnit to this node. Places the node at back at the end of
# the rotation. If we fail to send the WorkUnit, we consider the node to be
# down, and remove this record, freeing up all of its checked-out work units.
# If the Node responds that it's overloaded, we mark it as busy. Returns 
# true if the WorkUnit was dispatched successfully.
Dispatch a WorkUnit to this node. Places the node at back at the end of
the rotation. If we fail to send the WorkUnit, we consider the node to be
down, and remove this record, freeing up all of its checked-out work units.
If the Node responds that it's overloaded, we mark it as busy. Returns
true if the WorkUnit was dispatched successfully.
Dispatch a WorkUnit to this node . Places the node at back at the end of the rotation . If we fail to send the WorkUnit we consider the node to be down and remove this record freeing up all of its checked - out work units . If the Node responds that it ' s overloaded we mark it as busy . Returns true if the WorkUnit was dispatched successfully .
def send_work_unit(unit)
      result = node['/work'].post(:work_unit => unit.to_json)
      unit.assign_to(self, JSON.parse(result)['pid'])
      touch && true
    rescue RestClient::RequestFailed => e
      raise e unless e.http_code == 503 && e.http_body == Node::OVERLOADED_MESSAGE
      update_attribute(:busy, true) && false
    rescue RestClient::Exception, Errno::ECONNREFUSED, Timeout::Error
      destroy && false
    end
def send_work_unit ( unit ) result = node [ '/work' ] . post ( :work_unit => unit . to_json ) unit . assign_to ( self , JSON . parse ( result ) [ 'pid' ] ) touch && true rescue RestClient :: RequestFailed => e raise e unless e . http_code == 503 && e . http_body == Node :: OVERLOADED_MESSAGE update_attribute ( :busy , true ) && false rescue RestClient :: Exception , Errno :: ECONNREFUSED , Timeout :: Error destroy && false end
Dispatch a WorkUnit to this node.
Dispatch a WorkUnit to this node .
# Couldn't post to node, assume it's gone away.
unit
<not_specific>