def _send_msg_with_timeout(self):
     self.rabbit.declare_queue(topic_name())
     context = ReddwarfContext(is_admin=True, limit=5, marker=None)
     version = rpc.call(context,
                        topic_name(),
             {"method": "version",
              "args": {"package_name": "dpkg"}
         })
     return {"status": "good", "version": version}
Пример #2
0
 def _send_msg_with_timeout(self):
     self.rabbit.declare_queue(topic_name())
     context = ReddwarfContext(is_admin=True, limit=5, marker=None)
     version = rpc.call(context, topic_name(), {
         "method": "version",
         "args": {
             "package_name": "dpkg"
         }
     })
     return {"status": "good", "version": version}
Пример #3
0
    def call(self, context, msg, topic=None, version=None, timeout=None):
        """rpc.call() a remote method.

        :param context: The request context
        :param msg: The message to send, including the method and args.
        :param topic: Override the topic for this message.
        :param timeout: (Optional) A timeout to use when waiting for the
               response.  If no timeout is specified, a default timeout will be
               used that is usually sufficient.
        :param version: (Optional) Override the requested API version in this
               message.

        :returns: The return value from the remote method.
        """
        self._set_version(msg, version)
        return rpc.call(context, self._get_topic(topic), msg, timeout)
Пример #4
0
    def call(self, context, msg, topic=None, version=None, timeout=None):
        """rpc.call() a remote method.

        :param context: The request context
        :param msg: The message to send, including the method and args.
        :param topic: Override the topic for this message.
        :param timeout: (Optional) A timeout to use when waiting for the
               response.  If no timeout is specified, a default timeout will be
               used that is usually sufficient.
        :param version: (Optional) Override the requested API version in this
               message.

        :returns: The return value from the remote method.
        """
        self._set_version(msg, version)
        return rpc.call(context, self._get_topic(topic), msg, timeout)
Пример #5
0
    def _call(self, method_name, timeout_sec, **kwargs):
        LOG.debug("Calling %s" % method_name)

        timeout = Timeout(timeout_sec)
        try:
            result = rpc.call(self.context, self._get_routing_key(),
                              {'method': method_name, 'args': kwargs})
            LOG.debug("Result is %s" % result)
            return result
        except Exception as e:
            LOG.error(e)
            raise exception.GuestError(original_message=str(e))
        except Timeout as t:
            if t is not timeout:
                raise
            else:
                raise exception.GuestTimeout()
        finally:
            timeout.cancel()
Пример #6
0
    def _call(self, method_name, timeout_sec, **kwargs):
        LOG.debug("Calling %s" % method_name)

        timeout = Timeout(timeout_sec)
        try:
            result = rpc.call(self.context, self._get_routing_key(), {
                'method': method_name,
                'args': kwargs
            })
            LOG.debug("Result is %s" % result)
            return result
        except Exception as e:
            LOG.error(e)
            raise exception.GuestError(original_message=str(e))
        except Timeout as t:
            if t is not timeout:
                raise
            else:
                raise exception.GuestTimeout()
        finally:
            timeout.cancel()