Example #1
0
 def __init__(self, topic=None):
     super(ConductorAPI, self).__init__()
     self.topic = topic or constants.CONDUCTOR_TOPIC
     target = messaging.Target(topic=self.topic, version='1.0')
     serializer = objects_base.CyborgObjectSerializer()
     self.client = rpc.get_client(target,
                                  version_cap=self.RPC_API_VERSION,
                                  serializer=serializer)
Example #2
0
 def setUp(self, topic=None):
     super(TestRPCAPI, self).setUp()
     self.topic = topic or constants.AGENT_TOPIC
     target = messaging.Target(topic=self.topic,
                               version=self.RPC_API_VERSION)
     self.agent_rpcapi = AgentAPI()
     self.serializer = objects_base.CyborgObjectSerializer()
     self.client = rpc.get_client(target,
                                  version_cap=self.RPC_API_VERSION,
                                  serializer=self.serializer)
Example #3
0
    def start(self):
        super(RPCService, self).start()

        target = messaging.Target(topic=self.topic, server=self.host)
        endpoints = [self.manager]
        serializer = objects_base.CyborgObjectSerializer()
        self.rpcserver = rpc.get_server(target, endpoints, serializer)
        self.rpcserver.start()

        admin_context = context.get_admin_context()
        self.tg.add_dynamic_timer(
            self.manager.periodic_tasks,
            periodic_interval_max=CONF.periodic_interval,
            context=admin_context)

        LOG.info('Created RPC server for service %(service)s on host '
                 '%(host)s.',
                 {'service': self.topic, 'host': self.host})