Search in sources :

Example 6 with ExecutionTaskLog

use of com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog in project coprhd-controller by CoprHD.

the class ExecutionEngineMonitor method addTerminationTaskLog.

/**
 * Adds an execution task log indicating that the engine terminated during execution.
 *
 * @param state the execution state.
 */
private void addTerminationTaskLog(ExecutionState state, String detailedMessage) {
    ExecutionTaskLog log = new ExecutionTaskLog();
    log.setDate(new Date());
    log.setLevel(LogLevel.ERROR.toString());
    log.setMessage("Order Terminated");
    log.setDetail(detailedMessage);
    log.setPhase(ExecutionPhase.EXECUTE.name());
    modelClient.save(log);
    state.addExecutionTaskLog(log);
    modelClient.save(state);
}
Also used : ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog) Date(java.util.Date)

Example 7 with ExecutionTaskLog

use of com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog in project coprhd-controller by CoprHD.

the class ExecutionUtils method startViprTasks.

protected static <T> ViPRTasksMonitor<T> startViprTasks(ExecutionTask<Tasks<T>> task, ExecutionContext context) throws ExecutionException {
    ExecutionTaskLog log = context.logCurrentTask(task);
    long startTime = System.currentTimeMillis();
    try {
        injectValues(task, context);
        Tasks<T> result = task.executeTask();
        return new ViPRTasksMonitor<T>(context, log, result);
    } catch (Exception e) {
        long elapsedTime = System.currentTimeMillis() - startTime;
        context.updateCurrentTask(log, task, elapsedTime, e);
        throw new ExecutionException(e);
    }
}
Also used : ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog) MissingResourceException(java.util.MissingResourceException)

Example 8 with ExecutionTaskLog

use of com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog in project coprhd-controller by CoprHD.

the class ExecutionUtils method execute.

protected static <T> T execute(ExecutionTask<T> task, ExecutionContext context) throws ExecutionException {
    ExecutionTaskLog log = context.logCurrentTask(task);
    long startTime = System.currentTimeMillis();
    try {
        injectValues(task, context);
        T result = task.executeTask();
        long elapsedTime = System.currentTimeMillis() - startTime;
        context.updateCurrentTask(log, task, elapsedTime);
        return result;
    } catch (Exception e) {
        long elapsedTime = System.currentTimeMillis() - startTime;
        context.updateCurrentTask(log, task, elapsedTime, e);
        throw new ExecutionException(e);
    }
}
Also used : ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog) MissingResourceException(java.util.MissingResourceException)

Example 9 with ExecutionTaskLog

use of com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog in project coprhd-controller by CoprHD.

the class ExecutionUtils method startViprTask.

protected static <T> ViPRTaskMonitor<T> startViprTask(ExecutionTask<Task<T>> task, ExecutionContext context) throws ExecutionException {
    ExecutionTaskLog log = context.logCurrentTask(task);
    long startTime = System.currentTimeMillis();
    try {
        injectValues(task, context);
        Task<T> result = task.executeTask();
        return new ViPRTaskMonitor<T>(context, log, result);
    } catch (Exception e) {
        long elapsedTime = System.currentTimeMillis() - startTime;
        context.updateCurrentTask(log, task, elapsedTime, e);
        throw new ExecutionException(e);
    }
}
Also used : ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog) MissingResourceException(java.util.MissingResourceException)

Example 10 with ExecutionTaskLog

use of com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog in project coprhd-controller by CoprHD.

the class ExecutionContext method logCurrentTask.

public ExecutionTaskLog logCurrentTask(ExecutionTask<?> task) {
    setCurrentTask(task);
    ExecutionTaskLog log = new ExecutionTaskLog();
    log.setDate(new Date());
    log.setLevel(LogLevel.INFO.name());
    log.setMessage(task.getName());
    log.setDetail(task.getDetail());
    log.setPhase(getExecutionPhaseName());
    modelClient.save(log);
    executionState.addExecutionTaskLog(log);
    modelClient.save(executionState);
    return log;
}
Also used : ExecutionTaskLog(com.emc.storageos.db.client.model.uimodels.ExecutionTaskLog) Date(java.util.Date)

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