private SimpleTaskExecution doExecuteTask (TaskExecution aTask) throws Exception {
    MapContext context = new MapContext();
    try {
      long startTime = System.currentTimeMillis();
      logger.debug("Recived task: {}",aTask);
      
      // pre tasks
      executeSubTasks(aTask, aTask.getPre(), context);
      
      TaskExecution evaluatedTask = taskEvaluator.evaluate(aTask, context);
      
      TaskHandler<?> taskHandler = taskHandlerResolver.resolve(evaluatedTask);
      Object output = taskHandler.handle(evaluatedTask);
      SimpleTaskExecution completion = SimpleTaskExecution.of(evaluatedTask);
      if(output!=null) {
        completion.setOutput(output);
      }
      completion.setStatus(TaskStatus.COMPLETED);
      completion.setProgress(100);
      completion.setEndTime(new Date());
      completion.setExecutionTime(System.currentTimeMillis()-startTime);
      
      // post tasks
      executeSubTasks(aTask, aTask.getPost(), context);
      
      return completion;
    }
    finally {
      // finalize tasks
      executeSubTasks(aTask, aTask.getFinalize(), context);
    }
  }
Handle control tasks. Control tasks are used by the Coordinator
to control Worker instances. For example to stop an ongoing task
or to adjust something on a worker outside the context of a job.
src/main/java/com/creactiviti/piper/core/Worker.java