private int getNumberOfProvisionedInstances(String flowletId) { return twillController.getResourceReport().getRunnableResources(flowletId).size(); } }
private int getNumberOfProvisionedInstances(String flowletId) { return twillController.getResourceReport().getRunnableResources(flowletId).size(); }
public static int numRunning(TwillController controller, String runnableName) { return controller.getResourceReport().getRunnableResources(runnableName).size(); }
public static int numRunning(TwillController controller, String runnableName) { return controller.getResourceReport().getRunnableResources(runnableName).size(); }
public static int numRunning(TwillController controller, String runnableName) { return controller.getResourceReport().getRunnableResources(runnableName).size(); }
private void validateInstanceIds(String runnable, Set<Integer> instanceIds) { ResourceReport resourceReport = getResourceReport(); if (resourceReport == null) { throw new IllegalStateException("Unable to get resource report since application has not started."); } Collection<TwillRunResources> runnableResources = resourceReport.getRunnableResources(runnable); if (runnableResources == null) { throw new RuntimeException("Unable to verify run resources for runnable " + runnable); } Set<Integer> existingInstanceIds = Sets.newHashSet(); for (TwillRunResources twillRunResources : runnableResources) { existingInstanceIds.add(twillRunResources.getInstanceId()); } LOG.info("Existing instance ids: {}", existingInstanceIds); for (int instanceId : instanceIds) { if (!existingInstanceIds.contains(instanceId)) { throw new IllegalArgumentException("Unable to find instance id " + instanceId + " for " + runnable); } } }
private void validateInstanceIds(String runnable, Set<Integer> instanceIds) { ResourceReport resourceReport = getResourceReport(); if (resourceReport == null) { throw new IllegalStateException("Unable to get resource report since application has not started."); } Collection<TwillRunResources> runnableResources = resourceReport.getRunnableResources(runnable); if (runnableResources == null) { throw new RuntimeException("Unable to verify run resources for runnable " + runnable); } Set<Integer> existingInstanceIds = Sets.newHashSet(); for (TwillRunResources twillRunResources : runnableResources) { existingInstanceIds.add(twillRunResources.getInstanceId()); } LOG.info("Existing instance ids: {}", existingInstanceIds); for (int instanceId : instanceIds) { if (!existingInstanceIds.contains(instanceId)) { throw new IllegalArgumentException("Unable to find instance id " + instanceId + " for " + runnable); } } }
@Override public int getInstances() { Iterable<TwillController> twillControllerList = twillRunnerService.lookup(Constants.Service.MASTER_SERVICES); int instances = 0; if (twillControllerList != null) { for (TwillController twillController : twillControllerList) { if (twillController.getResourceReport() != null) { instances = twillController.getResourceReport().getRunnableResources(serviceName).size(); } } } return instances; }
@Override public int getInstances() { Iterable<TwillController> twillControllerList = twillRunnerService.lookup(Constants.Service.MASTER_SERVICES); int instances = 0; if (twillControllerList != null) { for (TwillController twillController : twillControllerList) { if (twillController.getResourceReport() != null) { instances = twillController.getResourceReport().getRunnableResources(serviceName).size(); } } } return instances; }
private boolean waitForDebugPort(TwillController controller, String runnable, int timeLimit) throws InterruptedException { long millis = 0; while (millis < 1000 * timeLimit) { ResourceReport report = controller.getResourceReport(); if (report == null || report.getRunnableResources(runnable) == null) { continue; } for (TwillRunResources resources : report.getRunnableResources(runnable)) { if (resources.getDebugPort() != null) { return true; } } TimeUnit.MILLISECONDS.sleep(100); millis += 100; } return false; }
private void waitForInstance(TwillController controller, String runnable, String yarnInstanceId, long timeout, TimeUnit timeoutUnit) throws InterruptedException, TimeoutException { Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); do { ResourceReport report = controller.getResourceReport(); if (report != null && report.getRunnableResources(runnable) != null) { for (TwillRunResources resources : report.getRunnableResources(runnable)) { if (resources.getContainerId().endsWith(yarnInstanceId)) { return; } } } TimeUnit.SECONDS.sleep(1); } while (stopwatch.elapsedTime(timeoutUnit) < timeout); throw new TimeoutException("Timeout reached while waiting for runnable " + runnable + " instance " + yarnInstanceId); }
private boolean waitForLogLevel(TwillController controller, String runnable, long timeout, TimeUnit timeoutUnit, @Nullable LogEntry.Level expected) throws InterruptedException { Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); do { ResourceReport report = controller.getResourceReport(); if (report == null || report.getRunnableResources(runnable) == null) { continue; } for (TwillRunResources resources : report.getRunnableResources(runnable)) { LogEntry.Level level = resources.getLogLevels().get(Logger.ROOT_LOGGER_NAME); if (expected == level) { return true; } } TimeUnit.MILLISECONDS.sleep(100); } while (stopwatch.elapsedTime(timeoutUnit) < timeout); return false; } }
do { ResourceReport report = controller.getResourceReport(); if (report == null || report.getRunnableResources(runnable) == null) { Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } else if (report.getRunnableResources(runnable) == null || report.getRunnableResources(runnable).size() != numOfResources) { Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } else { return report; Collection<TwillRunResources> runResources = report.getRunnableResources(runnable); boolean isSameContainer = false; for (TwillRunResources twillRunResources : runResources) {
Collection<TwillRunResources> resources; resources = report .getRunnableResources(org.apache.fluo.cluster.runnable.OracleRunnable.ORACLE_NAME); System.out.println("\nThe application has " + resources.size() + " of " + org.apache.fluo.cluster.util.FluoYarnConfig.getOracleInstances(config) .getRunnableResources(org.apache.fluo.cluster.runnable.WorkerRunnable.WORKER_NAME); System.out.println("\nThe application has " + resources.size() + " of " + org.apache.fluo.cluster.util.FluoYarnConfig.getWorkerInstances(config)
ResourceReport report = getResourceReport(controller, 30000); Collection<TwillRunResources> resources; resources = report.getRunnableResources(FluoOracleMain.ORACLE_NAME); System.out.println("\nThe application has " + resources.size() + " of " + config.getOracleInstances() + " desired Oracle containers:\n"); TwillUtil.printResources(resources); resources = report.getRunnableResources(FluoWorkerMain.WORKER_NAME); System.out.println("\nThe application has " + resources.size() + " of " + config.getWorkerInstances() + " desired Worker containers:\n");
ResourceReport report = controller.getResourceReport(); if (report == null || report.getRunnableResources(runnable) == null) { TimeUnit.MILLISECONDS.sleep(100); continue; for (TwillRunResources resources : report.getRunnableResources(runnable)) { LogEntry.Level actual = resources.getLogLevels().get(Logger.ROOT_LOGGER_NAME); Map<String, LogEntry.Level> actualArgs = resources.getLogLevels();
Collection<TwillRunResources> resources; resources = report .getRunnableResources(org.apache.fluo.cluster.runnable.OracleRunnable.ORACLE_NAME); System.out.println("\nThe application has " + resources.size() + " of " + org.apache.fluo.cluster.util.FluoYarnConfig.getOracleInstances(config) .getRunnableResources(org.apache.fluo.cluster.runnable.WorkerRunnable.WORKER_NAME); System.out.println("\nThe application has " + resources.size() + " of " + org.apache.fluo.cluster.util.FluoYarnConfig.getWorkerInstances(config)
return clusterEnriched; Collection<TwillRunResources> runResources = report.getRunnableResources(DacDaemonYarnApplication.YARN_RUNNABLE_NAME);
when(controller.getTwillService(cluster.getId())).thenReturn(twillRunnerService); when(twillController.getRunId()).thenReturn(runId); when(resourceReport.getRunnableResources(DacDaemonYarnApplication.YARN_RUNNABLE_NAME)).thenReturn(resources); when(twillRunnerService.lookup(DacDaemonYarnApplication.YARN_APPLICATION_NAME_DEFAULT, runId)).thenReturn(twillController); when(twillController.getResourceReport()).thenReturn(resourceReport);
Collection<TwillRunResources> runnableResources = resourceReport.getRunnableResources("sleep"); Assert.assertFalse(runnableResources.isEmpty()); TwillRunResources resources = runnableResources.iterator().next(); runnableResources = resourceReport.getRunnableResources("sleep2"); Assert.assertFalse(runnableResources.isEmpty()); resources = runnableResources.iterator().next();