/** * Executes a task in asynchronous mode. * @param task the task for execute. * @return the taskId of the task. */ private synchronized void startAsyncTask(final PipelineExecutorTask task) { final Future<?> future = executor.submit(() -> { final Pipeline pipeline = pipelineRegistry.getPipelineByName(task.getTaskDef().getPipeline()); try { pipelineExecutor.execute(task.getTaskDef().getInput(), pipeline, output -> processPipelineOutput(task, output), localListener); } catch (Exception e) { logger.error("An error was produced during pipeline execution for PipelineExecutorTask: " + task.getId(), e); } finally { removeTaskEntry(task.getId()); removeFutureTask(task.getId()); } }); storeFutureTask(task.getId(), future); }
/** * Executes a task in asynchronous mode. * @param task the task for execute. * @return the taskId of the task. */ private synchronized void startAsyncTask(final PipelineExecutorTask task) { final Future<?> future = executor.submit(() -> { final Pipeline pipeline = pipelineRegistry.getPipelineByName(task.getTaskDef().getPipeline()); try { pipelineExecutor.execute(task.getTaskDef().getInput(), pipeline, output -> processPipelineOutput(task, output), localListener); } catch (Exception e) { logger.error("An error was produced during pipeline execution for PipelineExecutorTask: " + task.getId(), e); } finally { removeTaskEntry(task.getId()); removeFutureTask(task.getId()); } }); storeFutureTask(task.getId(), future); }
/** * Executes a task definition in synchronous mode. * @param taskDef task definition for executing. * @return the taskId assigned to the executed task. */ private String executeSync(final PipelineExecutorTaskDef taskDef) { final PipelineExecutorTaskImpl task = taskManagerHelper.createTask(taskDef); storeTaskEntry(TaskEntry.newSyncEntry(task)); final Pipeline pipeline = pipelineRegistry.getPipelineByName(taskDef.getPipeline()); pipelineExecutor.execute(taskDef.getInput(), pipeline, output -> processPipelineOutput(task, output), localListener); removeTaskEntry(task.getId()); updateExecutorRegistry(task); return task.getId(); }
/** * Executes a task definition in synchronous mode. * @param taskDef task definition for executing. * @return the taskId assigned to the executed task. */ private String executeSync(final PipelineExecutorTaskDef taskDef) { final PipelineExecutorTaskImpl task = taskManagerHelper.createTask(taskDef); storeTaskEntry(TaskEntry.newSyncEntry(task)); final Pipeline pipeline = pipelineRegistry.getPipelineByName(taskDef.getPipeline()); pipelineExecutor.execute(taskDef.getInput(), pipeline, output -> processPipelineOutput(task, output), localListener); removeTaskEntry(task.getId()); updateExecutorRegistry(task); return task.getId(); }