def setUp(self): super(MockClusterToRegionRPCFixtureBase, self).setUp() # Use an inert clock with ClusterClientService so it doesn't update # itself except when we ask it to. self.rpc_service = ClusterClientService(Clock()) # Start up, but schedule stop first. self.addCleanup(self.asyncStop) self.asyncStart() # Return the Deferred so that callers from threads outside of the # reactor will block. In the reactor thread, a supporting test # framework may know how to handle this sanely. return self.starting
def start_services(): rpc_service = ClusterClientService(reactor) rpc_service.setName("rpc") rpc_service.setServiceParent(services) yield services.startService() for elapsed, remaining, wait in retries(15, 1, reactor): try: yield getRegionClient() except NoConnectionsAvailable: yield pause(wait, reactor) else: break else: print("Can't connect to the region.", file=stderr) raise SystemExit(1)
def _makeRPCService(self): from provisioningserver.rpc.clusterservice import ClusterClientService rpc_service = ClusterClientService(reactor) rpc_service.setName("rpc") return rpc_service