private QueueProcessorThread setupQueueProcessor() { return new QueueProcessorThread( this.azkProps.getBoolean(Constants.ConfigurationKeys.QUEUEPROCESSING_ENABLED, true), this.azkProps.getLong(Constants.ConfigurationKeys.ACTIVE_EXECUTOR_REFRESH_IN_MS, 50000), this.azkProps.getInt( Constants.ConfigurationKeys.ACTIVE_EXECUTOR_REFRESH_IN_NUM_FLOW, 5), this.azkProps.getInt( Constants.ConfigurationKeys.MAX_DISPATCHING_ERRORS_PERMITTED, this.activeExecutors.getAll().size()), this.sleepAfterDispatchFailure); }
private Executor selectExecutor(final ExecutableFlow exflow, final Set<Executor> availableExecutors) { Executor choosenExecutor = getUserSpecifiedExecutor(exflow.getExecutionOptions(), exflow.getExecutionId()); // If no executor was specified by admin if (choosenExecutor == null) { ExecutorManager.logger.info("Using dispatcher for execution id :" + exflow.getExecutionId()); final ExecutorSelector selector = new ExecutorSelector(ExecutorManager.this.filterList, ExecutorManager.this.comparatorWeightsMap); choosenExecutor = selector.getBest(availableExecutors, exflow); } return choosenExecutor; }
synchronized (exflow) { do { final Executor selectedExecutor = selectExecutor(exflow, remainingExecutors); if (selectedExecutor == null) { ExecutorManager.this.commonMetrics.markDispatchFail(); handleNoExecutorSelectedCase(reference, exflow); } catch (final ExecutorManagerException e) { lastError = e; logFailedDispatchAttempt(reference, exflow, selectedExecutor, e); ExecutorManager.this.commonMetrics.markDispatchFail(); reference.setNumErrors(reference.getNumErrors() + 1); updateRemainingExecutorsAndSleep(remainingExecutors, selectedExecutor);
int currentContinuousFlowProcessed = 0; while (isActive() && (ExecutorManager.this.runningCandidate = ExecutorManager.this.queuedFlows .fetchHead()) != null) { final ExecutionReference reference = ExecutorManager.this.runningCandidate.getFirst(); - (currentTime - lastExecutorRefreshTime); sleep(sleepInterval); } else { exflow.setUpdateTime(currentTime); selectExecutorAndDispatchFlow(reference, exflow); ExecutorManager.this.runningCandidate = null;
new QueueProcessorThread( this.azkProps.getBoolean(Constants.ConfigurationKeys.QUEUEPROCESSING_ENABLED, true), this.azkProps.getLong(Constants.ConfigurationKeys.ACTIVE_EXECUTOR_REFRESH_IN_MS, 50000),
synchronized (exflow) { for (int i = 0; i <= this.maxDispatchingErrors; i++) { final String giveUpReason = checkGiveUpDispatching(reference, remainingExecutors); if (giveUpReason != null) { logger.error("Failed to dispatch queued execution " + exflow.getId() + " because " final Executor selectedExecutor = selectExecutor(exflow, remainingExecutors); if (selectedExecutor == null) { ExecutorManager.this.commonMetrics.markDispatchFail(); handleNoExecutorSelectedCase(reference, exflow); logFailedDispatchAttempt(reference, exflow, selectedExecutor, e); ExecutorManager.this.commonMetrics.markDispatchFail(); reference.setNumErrors(reference.getNumErrors() + 1);
@Override public void run() { // Loops till QueueProcessorThread is shutdown while (!this.shutdown) { synchronized (this) { try { // start processing queue if active, other wait for sometime if (this.isActive) { processQueuedFlows(this.activeExecutorRefreshWindowInMillisec, this.activeExecutorRefreshWindowInFlows); } wait(QUEUE_PROCESSOR_WAIT_IN_MS); } catch (final Exception e) { logger.error( "QueueProcessorThread Interrupted. Probably to shut down.", e); } } } }
private Executor selectExecutor(final ExecutableFlow exflow, final Set<Executor> availableExecutors) { Executor choosenExecutor = getUserSpecifiedExecutor(exflow.getExecutionOptions(), exflow.getExecutionId()); // If no executor was specified by admin if (choosenExecutor == null) { logger.info("Using dispatcher for execution id :" + exflow.getExecutionId()); final ExecutorSelector selector = new ExecutorSelector(ExecutorManager.this.filterList, ExecutorManager.this.comparatorWeightsMap); choosenExecutor = selector.getBest(availableExecutors, exflow); } return choosenExecutor; }
public void shutdown() { this.shutdown = true; this.interrupt(); }
public State getQueueProcessorThreadState() { if (isMultiExecutorMode()) { return this.queueProcessor.getState(); } else { return State.NEW; // not started in local mode } }
/** * Returns state of QueueProcessor False, no flow is being dispatched True , flows are being * dispatched as expected */ public boolean isQueueProcessorThreadActive() { if (isMultiExecutorMode()) { return this.queueProcessor.isActive(); } else { return false; } }
int currentContinuousFlowProcessed = 0; while (isActive() && (ExecutorManager.this.runningCandidate = ExecutorManager.this.queuedFlows .fetchHead()) != null) { final ExecutionReference reference = ExecutorManager.this.runningCandidate.getFirst(); exflow.setUpdateTime(currentTime); selectExecutorAndDispatchFlow(reference, exflow); ExecutorManager.this.runningCandidate = null;
@Override public void run() { // Loops till QueueProcessorThread is shutdown while (!this.shutdown) { synchronized (this) { try { // start processing queue if active, other wait for sometime if (this.isActive) { processQueuedFlows(this.activeExecutorRefreshWindowInMillisec, this.activeExecutorRefreshWindowInFlows); } wait(QUEUE_PROCESSOR_WAIT_IN_MS); } catch (final Exception e) { ExecutorManager.logger.error( "QueueProcessorThread Interrupted. Probably to shut down.", e); } } } }
public void shutdown() { this.shutdown = true; this.interrupt(); }
public State getQueueProcessorThreadState() { return this.queueProcessor.getState(); }
/** * Returns state of QueueProcessor False, no flow is being dispatched True , flows are being * dispatched as expected */ public boolean isQueueProcessorThreadActive() { return this.queueProcessor.isActive(); }