@Override public Collection<Executor> getAllActiveExecutors() { List<Executor> executors = new ArrayList<>(); try { executors = this.executorLoader.fetchActiveExecutors(); } catch (final ExecutorManagerException e) { logger.error("Failed to get all active executors.", e); } return executors; }
private ImmutableSet<Executor> loadExecutors() throws ExecutorManagerException { logger.info("Initializing executors from database."); return ImmutableSet.copyOf(this.executorLoader.fetchActiveExecutors()); }
private Map<Integer, Executor> getActiveExecutors() { final Map<Integer, Executor> executorMap = new HashMap<>(); try { final List<Executor> executors = this.executorLoader.fetchActiveExecutors(); for (final Executor executor : executors) { executorMap.put(executor.getId(), executor); } } catch (final ExecutorManagerException e) { log.error("Fetching executors failed!", e); } return executorMap; }
@Override public Set<String> getPrimaryServerHosts() { final HashSet<String> ports = new HashSet<>(); try { for (final Executor executor : this.executorLoader.fetchActiveExecutors()) { ports.add(executor.getHost() + ":" + executor.getPort()); } } catch (final ExecutorManagerException e) { logger.error("Failed to get primary server hosts.", e); } return ports; }
private void testSetUpForRunningFlows() throws Exception { this.loader = mock(ExecutorLoader.class); this.apiGateway = mock(ExecutorApiGateway.class); this.user = TestUtils.getTestUser(); this.props.put(Constants.ConfigurationKeys.USE_MULTIPLE_EXECUTORS, "true"); //To test runningFlows, AZKABAN_QUEUEPROCESSING_ENABLED should be set to true //so that flows will be dispatched to executors. this.props.put(Constants.ConfigurationKeys.QUEUEPROCESSING_ENABLED, "true"); // allow two concurrent runs give one Flow this.props.put(Constants.ConfigurationKeys.MAX_CONCURRENT_RUNS_ONEFLOW, 2); final List<Executor> executors = new ArrayList<>(); final Executor executor1 = new Executor(1, "localhost", 12345, true); final Executor executor2 = new Executor(2, "localhost", 12346, true); executors.add(executor1); executors.add(executor2); when(this.loader.fetchActiveExecutors()).thenReturn(executors); this.manager = createExecutorManager(); this.flow1 = TestUtils.createTestExecutableFlow("exectest1", "exec1"); this.flow2 = TestUtils.createTestExecutableFlow("exectest1", "exec2"); this.flow1.setExecutionId(1); this.flow2.setExecutionId(2); final ExecutionReference ref1 = new ExecutionReference(this.flow1.getExecutionId(), executor1); final ExecutionReference ref2 = new ExecutionReference(this.flow2.getExecutionId(), executor2); this.activeFlows.put(this.flow1.getExecutionId(), new Pair<>(ref1, this.flow1)); this.activeFlows.put(this.flow2.getExecutionId(), new Pair<>(ref2, this.flow2)); when(this.loader.fetchActiveFlows()).thenReturn(this.activeFlows); }
this.activeExecutors = ImmutableList.of(executor1, executor2); this.allExecutors = ImmutableList.of(executor1, executor2, executor3); when(this.loader.fetchActiveExecutors()).thenReturn(this.activeExecutors);
newExecutors.addAll(this.executorLoader.fetchActiveExecutors()); } else if (this.azkProps.containsKey(ConfigurationKeys.EXECUTOR_PORT)) {