|
@@ -117,6 +117,7 @@ public class ActionDBAccessorImpl implements ActionDBAccessor {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public void abortOperation(long requestId) {
|
|
public void abortOperation(long requestId) {
|
|
|
|
+ long now = System.currentTimeMillis();
|
|
List<HostRoleCommandEntity> commands =
|
|
List<HostRoleCommandEntity> commands =
|
|
hostRoleCommandDAO.findByRequest(requestId);
|
|
hostRoleCommandDAO.findByRequest(requestId);
|
|
for (HostRoleCommandEntity command : commands) {
|
|
for (HostRoleCommandEntity command : commands) {
|
|
@@ -124,6 +125,7 @@ public class ActionDBAccessorImpl implements ActionDBAccessor {
|
|
command.getStatus() == HostRoleStatus.IN_PROGRESS ||
|
|
command.getStatus() == HostRoleStatus.IN_PROGRESS ||
|
|
command.getStatus() == HostRoleStatus.PENDING) {
|
|
command.getStatus() == HostRoleStatus.PENDING) {
|
|
command.setStatus(HostRoleStatus.ABORTED);
|
|
command.setStatus(HostRoleStatus.ABORTED);
|
|
|
|
+ command.setEndTime(now);
|
|
hostRoleCommandDAO.merge(command);
|
|
hostRoleCommandDAO.merge(command);
|
|
LOG.info("Aborting command. Hostname " + command.getHostName()
|
|
LOG.info("Aborting command. Hostname " + command.getHostName()
|
|
+ " role " + command.getRole()
|
|
+ " role " + command.getRole()
|
|
@@ -141,10 +143,12 @@ public class ActionDBAccessorImpl implements ActionDBAccessor {
|
|
@Transactional
|
|
@Transactional
|
|
public void timeoutHostRole(String host, long requestId, long stageId,
|
|
public void timeoutHostRole(String host, long requestId, long stageId,
|
|
String role) {
|
|
String role) {
|
|
|
|
+ long now = System.currentTimeMillis();
|
|
List<HostRoleCommandEntity> commands =
|
|
List<HostRoleCommandEntity> commands =
|
|
hostRoleCommandDAO.findByHostRole(host, requestId, stageId, role);
|
|
hostRoleCommandDAO.findByHostRole(host, requestId, stageId, role);
|
|
for (HostRoleCommandEntity command : commands) {
|
|
for (HostRoleCommandEntity command : commands) {
|
|
command.setStatus(HostRoleStatus.TIMEDOUT);
|
|
command.setStatus(HostRoleStatus.TIMEDOUT);
|
|
|
|
+ command.setEndTime(now);
|
|
hostRoleCommandDAO.merge(command);
|
|
hostRoleCommandDAO.merge(command);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -229,12 +233,20 @@ public class ActionDBAccessorImpl implements ActionDBAccessor {
|
|
+ "HostName " + hostname + " requestId " + requestId + " stageId "
|
|
+ "HostName " + hostname + " requestId " + requestId + " stageId "
|
|
+ stageId + " role " + role + " report " + report);
|
|
+ stageId + " role " + role + " report " + report);
|
|
}
|
|
}
|
|
|
|
+ long now = System.currentTimeMillis();
|
|
List<HostRoleCommandEntity> commands = hostRoleCommandDAO.findByHostRole(
|
|
List<HostRoleCommandEntity> commands = hostRoleCommandDAO.findByHostRole(
|
|
hostname, requestId, stageId, role);
|
|
hostname, requestId, stageId, role);
|
|
for (HostRoleCommandEntity command : commands) {
|
|
for (HostRoleCommandEntity command : commands) {
|
|
command.setStatus(HostRoleStatus.valueOf(report.getStatus()));
|
|
command.setStatus(HostRoleStatus.valueOf(report.getStatus()));
|
|
command.setStdOut(report.getStdOut().getBytes());
|
|
command.setStdOut(report.getStdOut().getBytes());
|
|
command.setStdError(report.getStdErr().getBytes());
|
|
command.setStdError(report.getStdErr().getBytes());
|
|
|
|
+ command.setStructuredOut(report.getStructuredOut() == null ? null :
|
|
|
|
+ report.getStructuredOut().getBytes()); // ===================================
|
|
|
|
+ if (command.getStatus() == HostRoleStatus.COMPLETED ||
|
|
|
|
+ command.getStatus() == HostRoleStatus.ABORTED ||
|
|
|
|
+ command.getStatus() == HostRoleStatus.FAILED) {
|
|
|
|
+ command.setEndTime(now);
|
|
|
|
+ }
|
|
command.setExitcode(report.getExitCode());
|
|
command.setExitcode(report.getExitCode());
|
|
hostRoleCommandDAO.merge(command);
|
|
hostRoleCommandDAO.merge(command);
|
|
}
|
|
}
|