use of com.facebook.presto.server.BasicQueryStats in project presto by prestodb.
the class QueryStateMachine method getBasicQueryInfo.
public BasicQueryInfo getBasicQueryInfo(Optional<BasicStageExecutionStats> rootStage) {
// Query state must be captured first in order to provide a
// correct view of the query. For example, building this
// information, the query could finish, and the task states would
// never be visible.
QueryState state = queryState.get();
BasicStageExecutionStats stageStats = rootStage.orElse(EMPTY_STAGE_STATS);
BasicQueryStats queryStats = new BasicQueryStats(queryStateTimer.getCreateTime(), getEndTime().orElse(null), queryStateTimer.getWaitingForPrerequisitesTime(), queryStateTimer.getQueuedTime(), queryStateTimer.getElapsedTime(), queryStateTimer.getExecutionTime(), getCurrentRunningTaskCount(), getPeakRunningTaskCount(), stageStats.getTotalDrivers(), stageStats.getQueuedDrivers(), stageStats.getRunningDrivers(), stageStats.getCompletedDrivers(), stageStats.getRawInputDataSize(), stageStats.getRawInputPositions(), stageStats.getCumulativeUserMemory(), stageStats.getCumulativeTotalMemory(), stageStats.getUserMemoryReservation(), stageStats.getTotalMemoryReservation(), succinctBytes(getPeakUserMemoryInBytes()), succinctBytes(getPeakTotalMemoryInBytes()), succinctBytes(getPeakTaskTotalMemory()), succinctBytes(getPeakNodeTotalMemory()), stageStats.getTotalCpuTime(), stageStats.getTotalScheduledTime(), stageStats.isFullyBlocked(), stageStats.getBlockedReasons(), stageStats.getTotalAllocation(), stageStats.getProgressPercentage());
return new BasicQueryInfo(queryId, session.toSessionRepresentation(), Optional.of(resourceGroup), state, memoryPool.get().getId(), stageStats.isScheduled(), self, query, queryStats, failureCause.get(), queryType, warningCollector.getWarnings(), preparedQuery);
}
use of com.facebook.presto.server.BasicQueryStats in project presto by prestodb.
the class TestMemoryManager method isBlockedWaitingForMemory.
private static boolean isBlockedWaitingForMemory(BasicQueryInfo info) {
BasicQueryStats stats = info.getQueryStats();
boolean isWaitingForMemory = stats.getBlockedReasons().contains(WAITING_FOR_MEMORY);
if (!isWaitingForMemory) {
return false;
}
// queries are not marked as fully blocked if there are no running drivers
return stats.isFullyBlocked() || stats.getRunningDrivers() == 0;
}
Aggregations