@Override public void run(IgniteServices services, String svcName, TestService svc) throws Exception { services.deployMultiple(svcName, (Service)svc, 0, 1); waitForServiceDeploymentIfNeeded(services, svcName); } }));
/** * Starts Apache Ignite services that represent distributed inference infrastructure. * * @param reader Inference model reader. * @param parser Inference model parser. * @param instances Number of service instances maintaining to make distributed inference. * @param maxPerNode Max per node number of instances. */ private void startService(ModelReader reader, ModelParser<I, O, ?> parser, int instances, int maxPerNode) { ignite.services().deployMultiple( String.format(INFERENCE_SERVICE_NAME_PATTERN, suffix), new IgniteDistributedInfModelService<>(reader, parser, suffix), instances, maxPerNode ); }
/** * Deploys multiple dotnet services. * * @param reader Binary reader. */ private void dotnetDeployMultiple(BinaryRawReaderEx reader) { String name = reader.readString(); Object svc = reader.readObjectDetached(); int totalCnt = reader.readInt(); int maxPerNodeCnt = reader.readInt(); services.deployMultiple(name, new PlatformDotNetServiceImpl(svc, platformCtx, srvKeepBinary), totalCnt, maxPerNodeCnt); }
/** * @throws Exception If failed. */ @Test public void testGetServicesByName() throws Exception { final String name = "servicesByName"; Ignite g = randomGrid(); g.services().deployMultiple(name, new DummyService(), nodeCount() * 2, 3); GridTestUtils.retryAssert(log, 50, 200, new CA() { @Override public void apply() { int cnt = 0; for (int i = 0; i < nodeCount(); i++) { Collection<DummyService> svcs = grid(i).services().services(name); if (svcs != null) cnt += svcs.size(); } assertEquals(nodeCount() * 2, cnt); } }); }
grid(0).services().deployMultiple(SERVICE_NAME, new CounterServiceImpl(), total, maxPerNode);
/** * @throws Exception If failed. */ @Test public void testDeployMultiple2Old() throws Exception { Ignite g = randomGrid(); String name = "serviceMultiple2Old"; int cnt = nodeCount() * 2 + 1; CountDownLatch latch = new CountDownLatch(cnt); DummyService.exeLatch(name, latch); IgniteServices svcs = g.services().withAsync(); svcs.deployMultiple(name, new DummyService(), cnt, 3); IgniteFuture<?> fut = svcs.future(); info("Deployed service: " + name); fut.get(); info("Finished waiting for service future: " + name); latch.await(); assertEquals(name, cnt, DummyService.started(name)); assertEquals(name, 0, DummyService.cancelled(name)); checkCount(name, g.services().serviceDescriptors(), cnt); }
/** * @throws Exception If failed. */ @Test public void testDeployMultiple1Old() throws Exception { Ignite g = randomGrid(); String name = "serviceMultiple1Old"; CountDownLatch latch = new CountDownLatch(nodeCount() * 2); DummyService.exeLatch(name, latch); IgniteServices svcs = g.services().withAsync(); svcs.deployMultiple(name, new DummyService(), nodeCount() * 2, 3); IgniteFuture<?> fut = svcs.future(); info("Deployed service: " + name); fut.get(); info("Finished waiting for service future: " + name); latch.await(); assertEquals(name, nodeCount() * 2, DummyService.started(name)); assertEquals(name, 0, DummyService.cancelled(name)); checkCount(name, g.services().serviceDescriptors(), nodeCount() * 2); }
/** * Deploys multiple dotnet services. * * @param reader Binary reader. */ private void dotnetDeployMultiple(BinaryRawReaderEx reader) { String name = reader.readString(); Object svc = reader.readObjectDetached(); int totalCnt = reader.readInt(); int maxPerNodeCnt = reader.readInt(); services.deployMultiple(name, new PlatformDotNetServiceImpl(svc, platformCtx, srvKeepBinary), totalCnt, maxPerNodeCnt); }