use of com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog in project coprhd-controller by CoprHD.
the class OrderMapper method toExecutionLogList.
public static ExecutionLogList toExecutionLogList(List<ExecutionTaskLog> executionTaskLogs) {
ExecutionLogList list = new ExecutionLogList();
for (ExecutionTaskLog executionTaskLog : executionTaskLogs) {
ExecutionLogRestRep executionLogRestRep = map(executionTaskLog);
list.getExecutionLogs().add(executionLogRestRep);
}
return list;
}
use of com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog in project coprhd-controller by CoprHD.
the class ServiceRunner method dumpOrder.
public static void dumpOrder(Order order) {
print("Order: %s", order.getId());
print(" Status: %s", order.getOrderStatus());
print(" Message: %s", order.getMessage());
CatalogService service = load(order.getCatalogServiceId(), CatalogService.class);
print(" Service: %s (%s)", service.getLabel(), service.getBaseService());
ExecutionState state = load(order.getExecutionStateId(), ExecutionState.class);
print(" Time: %s -> %s (%.1f s)", state.getStartDate(), state.getEndDate(), (state.getEndDate().getTime() - state.getStartDate().getTime()) / 1000.0);
List<ExecutionLog> logs = load(state.getLogIds(), ExecutionLog.class);
Collections.sort(logs, LOG_COMPARATOR);
if (!logs.isEmpty()) {
print(" Logs");
for (ExecutionLog log : logs) {
print(" - %s\t%s\t%s", log.getDate(), log.getLevel(), log.getMessage());
}
}
List<ExecutionTaskLog> taskLogs = load(state.getTaskLogIds(), ExecutionTaskLog.class);
Collections.sort(taskLogs, LOG_COMPARATOR);
if (!taskLogs.isEmpty()) {
print(" Task Logs");
for (ExecutionTaskLog log : taskLogs) {
print(" - %s\t%s\t%s\t%s", log.getDate(), log.getLevel(), log.getMessage(), log.getDetail());
}
}
}
use of com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog in project coprhd-controller by CoprHD.
the class OrderService method getOrderExecutionTaskLogs.
/**
* Gets the order execution logs
*
* @param orderId the URN of an order
* @brief Get Order Execution Logs
* @return order execution logs
* @throws DatabaseException when a DB error occurs
*/
@GET
@Path("/{id}/execution/logs")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public ExecutionLogList getOrderExecutionTaskLogs(@PathParam("id") String orderId) throws DatabaseException {
Order order = queryResource(uri(orderId));
StorageOSUser user = getUserFromContext();
verifyAuthorizedInTenantOrg(uri(order.getTenant()), user);
List<ExecutionTaskLog> executionTaskLogs = orderManager.getOrderExecutionTaskLogs(order);
return toExecutionLogList(executionTaskLogs);
}
use of com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog in project coprhd-controller by CoprHD.
the class OrderService method dumpOrder.
private void dumpOrder(PrintStream out, Order order) {
out.print(order.toString());
out.println("Parameters");
out.println("----------");
List<OrderParameter> parameters = orderManager.getOrderParameters(order.getId());
for (OrderParameter parameter : parameters) {
out.print(parameter.toString());
}
out.println("Execution State");
out.println("---------------");
ExecutionState state = orderManager.getOrderExecutionState(order.getExecutionStateId());
if (state != null) {
out.print(state.toString());
}
out.println("Logs");
out.println("----");
out.println(" Execution Logs");
if (state != null) {
List<ExecutionLog> elogs = orderManager.getOrderExecutionLogs(order);
for (ExecutionLog elog : elogs) {
out.print(elog.toString());
}
}
out.println(" Execution Task Logs");
if (state != null) {
List<ExecutionTaskLog> tlogs = orderManager.getOrderExecutionTaskLogs(order);
for (ExecutionTaskLog tlog : tlogs) {
out.print(tlog.toString());
}
}
}
use of com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog in project coprhd-controller by CoprHD.
the class ExecutionEngineMonitor method killOrder.
/**
* Kills an order that was running within a dead engine.
*
* @param orderId
* the order ID.
* @param detailedMessage
* message to be added to order log
*/
public void killOrder(URI orderId, String detailedMessage) {
try {
Order order = modelClient.orders().findById(orderId);
if (order != null) {
if (log.isInfoEnabled()) {
log.info("Killing order: " + orderId);
}
// Mark the order as failed
order.setOrderStatus(OrderStatus.ERROR.name());
modelClient.save(order);
if (order.getExecutionStateId() != null) {
ExecutionState execState = modelClient.executionStates().findById(order.getExecutionStateId());
// Mark the execution state as failed
execState.setExecutionStatus(ExecutionStatus.FAILED.name());
modelClient.save(execState);
// Find any task logs that are 'in progress' (no elapsed time) and set the elapsed
List<ExecutionTaskLog> logs = modelClient.executionTaskLogs().findByIds(execState.getTaskLogIds());
for (ExecutionTaskLog log : logs) {
if (log.getElapsed() == null) {
// Mark any that were in progress as warnings
log.setLevel(LogLevel.WARN.name());
modelClient.save(log);
}
}
// Add a new log message indicating it failed due to engine termination
addTerminationTaskLog(execState, detailedMessage);
}
}
} catch (RuntimeException e) {
log.error("Failed to terminate order: " + orderId, e);
}
}
Aggregations