Example #1
0
 def test_multicall_succeed_three_times_yield(self):
     value = 42
     result = rpc.multicall(self.context,
                           'test',
                           {"method": "echo_three_times_yield",
                            "args": {"value": value}})
     for i, x in enumerate(result):
         self.assertEqual(value + i, x)
Example #2
0
 def test_multicall_succeed_three_times_yield(self):
     value = 42
     result = rpc.multicall(self.context, 'test', {
         "method": "echo_three_times_yield",
         "args": {
             "value": value
         }
     })
     for i, x in enumerate(result):
         self.assertEqual(value + i, x)
Example #3
0
 def test_multicall_succeed_once(self):
     value = 42
     result = rpc.multicall(self.context,
                           'test',
                           {"method": "echo",
                            "args": {"value": value}})
     for i, x in enumerate(result):
         if i > 0:
             self.fail('should only receive one response')
         self.assertEqual(value + i, x)
Example #4
0
 def test_multicall_succeed_once(self):
     value = 42
     result = rpc.multicall(self.context, 'test', {
         "method": "echo",
         "args": {
             "value": value
         }
     })
     for i, x in enumerate(result):
         if i > 0:
             self.fail('should only receive one response')
         self.assertEqual(value + i, x)
Example #5
0
    def multicall(self, context, msg, topic=None, version=None, timeout=None):
        """rpc.multicall() 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: An iterator that lets you process each of the returned values
                  from the remote method as they arrive.
        """
        self._set_version(msg, version)
        return rpc.multicall(context, self._get_topic(topic), msg, timeout)