@Test public void testGetAllRunningWorkers() { WorkerRegistryV2 workerRegistryV2 = new WorkerRegistryV2(); initRegistryWithWorkers(workerRegistryV2,"testGetAllRunningWorkers-1", 5); Set<WorkerId> allRunningWorkers = workerRegistryV2.getAllRunningWorkers(); assertEquals(5, allRunningWorkers.size()); }
@Override public Set<WorkerId> getAllRunningWorkers() { return jobToWorkerInfoMap.values().stream() .flatMap(workerList -> workerList.stream() .filter(wm -> WorkerState.isRunningState(wm.getState())) .map(workerMeta -> workerMeta.getWorkerId())) .collect(Collectors.toSet()); }
WorkerRegistryV2 implements WorkerRegistry, WorkerEventSubscriber { @Override public Set<WorkerId> getAllRunningWorkers() { return jobToWorkerInfoMap.values().stream() .flatMap(workerList -> workerList.stream() .filter(wm -> WorkerState.isRunningState(wm.getState())) .map(workerMeta -> workerMeta.getWorkerId())) .collect(Collectors.toSet()); } }
WorkerRegistryV2 implements WorkerRegistry, WorkerEventSubscriber { @Override public Set<WorkerId> getAllRunningWorkers() { return jobToWorkerInfoMap.values().stream() .flatMap(workerList -> workerList.stream() .filter(wm -> WorkerState.isRunningState(wm.getState())) .map(workerMeta -> workerMeta.getWorkerId())) .collect(Collectors.toSet()); } WorkerRegistryV2(); }
WorkerRegistryV2 implements WorkerRegistry, WorkerEventSubscriber { @Override public Set<WorkerId> getAllRunningWorkers() { return jobToWorkerInfoMap.values().stream() .flatMap(workerList -> workerList.stream() .filter(wm -> WorkerState.isRunningState(wm.getState())) .map(workerMeta -> workerMeta.getWorkerId())) .collect(Collectors.toSet()); } WorkerRegistryV2(); static Props props(); void clearState(); @Override int getNumRunningWorkers(); @Override Set<WorkerId> getAllRunningWorkers(); @Override Map<WorkerId, String> getAllRunningWorkerSlaveIdMappings(); @Override boolean isWorkerValid(WorkerId workerId); @Override Optional<Long> getAcceptedAt(WorkerId workerId); @Override void process(LifecycleEventsProto.WorkerListChangedEvent event); @Override void process(LifecycleEventsProto.JobStatusEvent statusEvent); }
WorkerRegistryV2 implements WorkerRegistry, WorkerEventSubscriber { @Override public Set<WorkerId> getAllRunningWorkers() { return jobToWorkerInfoMap.values().stream() .flatMap(workerList -> workerList.stream() .filter(wm -> WorkerState.isRunningState(wm.getState())) .map(workerMeta -> workerMeta.getWorkerId())) .collect(Collectors.toSet()); } WorkerRegistryV2(); static Props props(); void clearState(); @Override int getNumRunningWorkers(); @Override Set<WorkerId> getAllRunningWorkers(); @Override Map<WorkerId, String> getAllRunningWorkerSlaveIdMappings(); @Override boolean isWorkerValid(WorkerId workerId); @Override Optional<Long> getAcceptedAt(WorkerId workerId); @Override void process(LifecycleEventsProto.WorkerListChangedEvent event); @Override void process(LifecycleEventsProto.JobStatusEvent statusEvent); static final WorkerRegistryV2 INSTANCE; }