protected boolean wasAgentRestartedDuringOperation(Host host, Stage stage, String role) {
    String hostName = host.getHostName();
    long taskStartTime = stage.getHostRoleCommand(hostName, role).getStartTime();
    long lastAgentStartTime = host.getLastAgentStartTime();
    return taskStartTime > 0 && lastAgentStartTime > 0 && taskStartTime <= lastAgentStartTime;
  }
Checks if ambari-agent was restarted during role command execution
@param host the host with ambari-agent to check
@param stage the stage
@param role the role to check
@return {@code true} if ambari-agent was restarted
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java