def send_work_unit(unit)
      result = node['/work'].post(:work_unit => unit.to_json)
      unit.assign_to(self, JSON.parse(result.body)['pid'])
      touch && true
    rescue RestClient::RequestTimeout
      # The node's gone away.  Destroy it and it will check in when it comes back
      CloudCrowd.log "Node #{host} received RequestTimeout, removing it"
      destroy && false
    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, Errno::ECONNRESET=>e
      # Couldn't post to node, assume it's gone away.
      CloudCrowd.log "Node #{host} received #{e.class} #{e}, removing it"
      destroy && false
    end
def send_work_unit(unit)
      result = node['/work'].post(:work_unit => unit.to_json)
      unit.assign_to(self, JSON.parse(result.body)['pid'])
      touch && true
    rescue RestClient::RequestTimeout
      # The node's gone away.  Destroy it and it will check in when it comes back
      CloudCrowd.log "Node #{host} received RequestTimeout, removing it"
      destroy && false
    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, Errno::ECONNRESET=>e
      # Couldn't post to node, assume it's gone away.
      CloudCrowd.log "Node #{host} received #{e.class} #{e}, removing it"
      destroy && false
    end
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.