@Override public void init(Configuration conf) { tajoConf = (TajoConf) conf; queryTaskContext .getDispatcher() .register(TaskRunnerGroupEvent.EventType.class, new TajoTaskRunnerLauncher()); // queryTaskContext .getDispatcher() .register(ContainerAllocatorEventType.class, new TajoWorkerAllocationHandler()); super.init(conf); }
private void stopContainers(Collection<Container> containers) { for (Container container : containers) { final ContainerProxy proxy = queryTaskContext.getResourceAllocator().getContainer(container.getId()); executorService.submit(new StopContainerRunner(container.getId(), proxy)); } }
public TajoResourceAllocator(QueryMasterTask.QueryMasterTaskContext queryTaskContext) { this.queryTaskContext = queryTaskContext; executorService = Executors.newFixedThreadPool( queryTaskContext .getConf() .getIntVar(TajoConf.ConfVars.YARN_RM_TASKRUNNER_LAUNCH_PARALLEL_NUM)); }
@Override public synchronized void stop() { if (stopped.get()) { return; } stopped.set(true); executorService.shutdownNow(); Map<ContainerId, ContainerProxy> containers = queryTaskContext.getResourceAllocator().getContainers(); List<ContainerProxy> list = new ArrayList<ContainerProxy>(containers.values()); for (ContainerProxy eachProxy : list) { try { eachProxy.stopContainer(); } catch (Exception e) { } } super.stop(); }