def request(self, method, url, body=None, headers={}):
        """
        """

        # from octopus.dispatcher import settings
        # LOGGER.debug("Send request to RN: http://%s:%s%s %s (%s)" % (self.host, self.port, url, method, headers))

        err = None
        conn = self.getHTTPConnection()

        # try to process the request at most RENDERNODE_REQUEST_MAX_RETRY_COUNT times.
        for i in xrange(singletonconfig.get('COMMUNICATION', 'RENDERNODE_REQUEST_MAX_RETRY_COUNT')):
            try:
                conn.request(method, url, body, headers)
                response = conn.getresponse()
                if response.length:
                    data = response.read(response.length)
                else:
                    data = None
                # request succeeded
                conn.close()
                return (response, data)
            except http.socket.error, e:
                err = e
                # LOGGER.debug("socket error %r" % e)
                try:
                    conn.close()
                except:
                    pass
                if e in (errno.ECONNREFUSED, errno.ENETUNREACH):
                    raise self.RequestFailed(cause=e)
            except http.HTTPException, e:
                err = e
                # LOGGER.debug("HTTPException %r" % e)
                try:
                    conn.close()
                except:
                    pass
                LOGGER.exception("rendernode.request failed")

            LOGGER.warning("request failed (%d/%d), reason: %s" % (i + 1, singletonconfig.get('COMMUNICATION', 'RENDERNODE_REQUEST_MAX_RETRY_COUNT'), err))
            # request failed so let's sleep for a while
            time.sleep(singletonconfig.get('COMMUNICATION', 'RENDERNODE_REQUEST_DELAY_AFTER_REQUEST_FAILURE'))

        # request failed too many times so reset the RN (without pausing) and set quarantine
        self.reset(paused=False)
        self.excluded = True
        LOGGER.warning("A network call to the node %s can not be completed --> put in quarantine" % (self.name))
        raise self.RequestFailed()
dataset/ETHPy150Open mikrosimage/OpenRenderManagement/src/octopus/dispatcher/model/rendernode.py/RenderNode.request/original