private void publishInProgressTasks(List<Stage> stages) {
    if (taskStatusLoaded.compareAndSet(false, true)) {
      if (!stages.isEmpty()) {
        Function<Stage, Long> transform = new Function<Stage, Long>() {
          @Override
          public Long apply(Stage stage) {
            return stage.getRequestId();
          }
        };
        Set<Long> runningRequestID = ImmutableSet.copyOf(Lists.transform(stages, transform));
        List<HostRoleCommand> hostRoleCommands = db.getAllTasksByRequestIds(runningRequestID);
        hostRoleCommandDAO.publishTaskCreateEvent(hostRoleCommands);
      }
    }
  }
publish event to load {@link TaskStatusListener#activeTasksMap} {@link TaskStatusListener#activeStageMap}
and {@link TaskStatusListener#activeRequestMap} for all running request once during server startup.
This is required as some tasks may have been in progress when server was last stopped
@param stages list of stages
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java