public void saveTaskHistory(SingularityTaskHistory taskHistory) {
if (history.getTaskHistoryForTask(taskHistory.getTask().getTaskId().getId()) != null) {
return;
}
SingularityTaskIdHistory taskIdHistory = SingularityTaskIdHistory.fromTaskIdAndUpdates(taskHistory.getTask().getTaskId(), taskHistory.getTaskUpdates());
String lastTaskStatus = null;
if (taskIdHistory.getLastTaskState().isPresent()) {
lastTaskStatus = taskIdHistory.getLastTaskState().get().name();
}
history.insertTaskHistory(taskIdHistory.getTaskId().getRequestId(), taskIdHistory.getTaskId().getId(), taskHistoryTranscoder.toBytes(taskHistory), new Date(taskIdHistory.getUpdatedAt()), lastTaskStatus);
}