@Override public Executor fetchExecutor(final int executorId) throws ExecutorManagerException { return this.executorLoader.fetchExecutor(executorId); }
private boolean isExecutorRemoved(final int id) { final Executor fetchedExecutor; try { fetchedExecutor = this.executorLoader.fetchExecutor(id); } catch (final ExecutorManagerException e) { logger.error("Couldn't check if executor exists", e); // don't know if removed or not -> default to false return false; } return fetchedExecutor == null; }
/** * {@inheritDoc} * * @see azkaban.executor.ExecutorManagerAdapter#fetchExecutor(int) */ @Override public Executor fetchExecutor(final int executorId) throws ExecutorManagerException { for (final Executor executor : this.activeExecutors.getAll()) { if (executor.getId() == executorId) { return executor; } } return this.executorLoader.fetchExecutor(executorId); }
"User specified executor id: %d for execution id: %d is not active, Looking up db.", executorId, executionId)); executor = ExecutorManager.this.executorLoader.fetchExecutor(executorId); if (executor == null) { ExecutorManager.logger
/** * Should finalize execution if executor doesn't exist in the DB. */ @Test public void updateExecutionsUpdateCallFailsExecutorDoesntExist() throws Exception { mockUpdateCallFails(); when(this.executorLoader.fetchExecutor(anyInt())).thenReturn(null); DateTimeUtils.setCurrentMillisFixed(System.currentTimeMillis()); this.updater.updateExecutions(); verify(this.executionFinalizer).finalizeFlow( this.execution, "Not running on the assigned executor (any more)", null); }
/** * Shouldn't finalize executions if executor's existence can't be checked. */ @Test public void updateExecutionsUpdateCallFailsExecutorCheckThrows() throws Exception { mockUpdateCallFails(); when(this.executorLoader.fetchExecutor(anyInt())) .thenThrow(new ExecutorManagerException("Mocked fetchExecutor failure")); DateTimeUtils.setCurrentMillisFixed(System.currentTimeMillis()); this.updater.updateExecutions(); verifyZeroInteractions(this.executionFinalizer); }
@Test public void updateExecutionsUpdateCallFails() throws Exception { mockUpdateCallFails(); when(this.executorLoader.fetchExecutor(anyInt())).thenReturn(this.activeExecutor); DateTimeUtils.setCurrentMillisFixed(System.currentTimeMillis()); for (int i = 0; i < this.updater.numErrorsBeforeUnresponsiveEmail; i++) { this.updater.updateExecutions(); DateTimeUtils.setCurrentMillisFixed( DateTimeUtils.currentTimeMillis() + this.updater.errorThreshold + 1L); } verify(this.mailAlerter).alertOnFailedUpdate( this.activeExecutor, Collections.singletonList(this.execution), API_CALL_EXCEPTION); verifyZeroInteractions(this.executionFinalizer); }
/** * {@inheritDoc} * * @see azkaban.executor.ExecutorManagerAdapter#fetchExecutor(int) */ @Override public Executor fetchExecutor(final int executorId) throws ExecutorManagerException { for (final Executor executor : this.activeExecutors) { if (executor.getId() == executorId) { return executor; } } return this.executorLoader.fetchExecutor(executorId); }
"User specified executor id: %d for execution id: %d is not active, Looking up db.", executorId, executionId)); executor = ExecutorManager.this.executorLoader.fetchExecutor(executorId); if (executor == null) { logger
executorHost, executorPort)); Executor executor = this.executorLoader.fetchExecutor(executorHost, executorPort); if (executor == null) { executor = this.executorLoader.addExecutor(executorHost, executorPort);