private void createTasksForReplay(TopologyHostRequestEntity entity) {
    topologyTasks.add(new PersistHostResourcesTask(topology, this));
    topologyTasks.add(new RegisterWithConfigGroupTask(topology, this));
    InstallHostTask installTask = new InstallHostTask(topology, this, skipFailure);
    topologyTasks.add(installTask);
    logicalTaskMap.put(installTask, new HashMap<>());

    boolean skipStartTaskCreate = topology.getProvisionAction().equals(INSTALL_ONLY);

    if (!skipStartTaskCreate) {
      StartHostTask startTask = new StartHostTask(topology, this, skipFailure);
      topologyTasks.add(startTask);
      logicalTaskMap.put(startTask, new HashMap<>());
    }

    AmbariContext ambariContext = topology.getAmbariContext();
    // lower level logical component level tasks which get mapped to physical tasks
    for (TopologyHostTaskEntity topologyTaskEntity : entity.getTopologyHostTaskEntities()) {
      TopologyTask.Type taskType = TopologyTask.Type.valueOf(topologyTaskEntity.getType());
      for (TopologyLogicalTaskEntity logicalTaskEntity : topologyTaskEntity.getTopologyLogicalTaskEntities()) {
        Long logicalTaskId = logicalTaskEntity.getId();
        String component = logicalTaskEntity.getComponentName();

        AmbariContext.TaskType logicalTaskType = getLogicalTaskType(taskType);
        HostRoleCommand task = ambariContext.createAmbariTask(logicalTaskId, getRequestId(), id,
            component, entity.getHostName(), logicalTaskType, skipFailure);

        logicalTasks.put(logicalTaskId, task);
        Long physicalTaskId = logicalTaskEntity.getPhysicalTaskId();
        if (physicalTaskId != null) {
          registerPhysicalTaskId(logicalTaskId, physicalTaskId);
        }

        //assumes only one task per type
        for (TopologyTask topologyTask : topologyTasks) {
          if (taskType == topologyTask.getType()) {
            logicalTaskMap.get(topologyTask).put(component, logicalTaskId);
          }
        }
      }
    }
  }
Only to be used when replaying persisted requests upon server startup.

@param requestId    logical request id
@param id           host request id
@param predicate    host predicate
@param topology     cluster topology
@param entity       host request entity
ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java