public void init(WorkflowExecutor workflowExecutor) { ScheduledExecutorService deciderPool = Executors.newScheduledThreadPool(1); deciderPool.scheduleWithFixedDelay(() -> { try { boolean disable = config.disableSweep(); if (disable) { logger.info("Workflow sweep is disabled."); return; } List<String> workflowIds = queueDAO.pop(WorkflowExecutor.DECIDER_QUEUE, 2 * executorThreadPoolSize, 2000); int currentQueueSize = queueDAO.getSize(WorkflowExecutor.DECIDER_QUEUE); logger.debug("Sweeper's current deciderqueue size: {}.", currentQueueSize); int retrievedWorkflows = (workflowIds != null) ? workflowIds.size() : 0; logger.debug("Sweeper retrieved {} workflows from the decider queue.", retrievedWorkflows); sweep(workflowIds, workflowExecutor); } catch (Exception e) { Monitors.error(className, "sweep"); logger.error("Error when sweeping workflow", e); } }, 500, 500, TimeUnit.MILLISECONDS); }
@Inject public WorkflowSweeper(WorkflowExecutor workflowExecutor, Configuration config, QueueDAO queueDAO) { this.config = config; this.queueDAO = queueDAO; this.executorThreadPoolSize = config.getIntProperty("workflow.sweeper.thread.count", 5); if(this.executorThreadPoolSize > 0) { this.executorService = Executors.newFixedThreadPool(executorThreadPoolSize); init(workflowExecutor); logger.info("Workflow Sweeper Initialized"); } else { logger.warn("Workflow sweeper is DISABLED"); } }
workflowSweeper.sweep(Arrays.asList(wfid), workflowExecutor); es = workflowExecutionService.getExecutionStatus(wfid, true); assertNotNull(es);
@Inject public WorkflowSweeper(WorkflowExecutor workflowExecutor, Configuration config, QueueDAO queueDAO) { this.config = config; this.queueDAO = queueDAO; this.executorThreadPoolSize = config.getIntProperty("workflow.sweeper.thread.count", 5); if(this.executorThreadPoolSize > 0) { this.executorService = Executors.newFixedThreadPool(executorThreadPoolSize); init(workflowExecutor); logger.info("Workflow Sweeper Initialized"); } else { logger.warn("Workflow sweeper is DISABLED"); } }
public void init(WorkflowExecutor workflowExecutor) { ScheduledExecutorService deciderPool = Executors.newScheduledThreadPool(1); deciderPool.scheduleWithFixedDelay(() -> { try { boolean disable = config.disableSweep(); if (disable) { logger.info("Workflow sweep is disabled."); return; } List<String> workflowIds = queueDAO.pop(WorkflowExecutor.DECIDER_QUEUE, 2 * executorThreadPoolSize, 2000); int currentQueueSize = queueDAO.getSize(WorkflowExecutor.DECIDER_QUEUE); logger.debug("Sweeper's current deciderqueue size: {}.", currentQueueSize); int retrievedWorkflows = (workflowIds != null) ? workflowIds.size() : 0; logger.debug("Sweeper retrieved {} workflows from the decider queue.", retrievedWorkflows); sweep(workflowIds, workflowExecutor); } catch (Exception e) { Monitors.error(className, "sweep"); logger.error("Error when sweeping workflow", e); } }, 500, 500, TimeUnit.MILLISECONDS); }