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);
}
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);
}
}
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);
}
}
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);
}
}
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;
}
Aggregations