Search in sources :

Example 1 with ExecutionTaskLog

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;
}
Also used : ExecutionLogList(com.emc.vipr.model.catalog.ExecutionLogList) ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog) ExecutionLogRestRep(com.emc.vipr.model.catalog.ExecutionLogRestRep)

Example 2 with ExecutionTaskLog

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());
        }
    }
}
Also used : ExecutionState(com.emc.storageos.db.client.model.uimodels.ExecutionState) ExecutionLog(com.emc.storageos.db.client.model.uimodels.ExecutionLog) CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog)

Example 3 with ExecutionTaskLog

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);
}
Also used : Order(com.emc.storageos.db.client.model.uimodels.Order) StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 4 with ExecutionTaskLog

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());
        }
    }
}
Also used : ExecutionState(com.emc.storageos.db.client.model.uimodels.ExecutionState) ExecutionLog(com.emc.storageos.db.client.model.uimodels.ExecutionLog) OrderParameter(com.emc.storageos.db.client.model.uimodels.OrderParameter) ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog)

Example 5 with ExecutionTaskLog

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);
    }
}
Also used : Order(com.emc.storageos.db.client.model.uimodels.Order) ExecutionState(com.emc.storageos.db.client.model.uimodels.ExecutionState) ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog)

Aggregations

ExecutionTaskLog (com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog)11 ExecutionState (com.emc.storageos.db.client.model.uimodels.ExecutionState)3 MissingResourceException (java.util.MissingResourceException)3 ExecutionLog (com.emc.storageos.db.client.model.uimodels.ExecutionLog)2 Order (com.emc.storageos.db.client.model.uimodels.Order)2 Date (java.util.Date)2 BaseModelTest (com.emc.sa.model.BaseModelTest)1 CatalogService (com.emc.storageos.db.client.model.uimodels.CatalogService)1 OrderParameter (com.emc.storageos.db.client.model.uimodels.OrderParameter)1 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)1 ExecutionLogList (com.emc.vipr.model.catalog.ExecutionLogList)1 ExecutionLogRestRep (com.emc.vipr.model.catalog.ExecutionLogRestRep)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Test (org.junit.Test)1