npawar commented on code in PR #8539: URL: https://github.com/apache/pinot/pull/8539#discussion_r850688941
########## pinot-tools/src/main/java/org/apache/pinot/tools/perf/QueryRunner.java: ########## @@ -416,42 +422,49 @@ public static QuerySummary multiThreadedQueryRunner(PerfBenchmarkDriverConf conf long reportStartTime = startTime; int numReportIntervals = 0; int numTimesExecuted = 0; - while (numTimesToRunQueries == 0 || numTimesExecuted < numTimesToRunQueries) { - if (executorService.isTerminated()) { - throw new IllegalThreadStateException("All threads got exception and already dead."); - } - - if (timeout > 0 && System.currentTimeMillis() - startTimeAbsolute > timeout) { - throw new TimeoutException("Timeout of " + timeout + " sec reached. Aborting"); - } + try { + while (numTimesToRunQueries == 0 || numTimesExecuted < numTimesToRunQueries) { + if (executorService.isTerminated()) { + throw new IllegalThreadStateException("All threads got exception and already dead."); + } - for (String query : queries) { - while (!queryQueue.offer(query)) { - Thread.sleep(1); + if (timeout > 0 && System.currentTimeMillis() - startTimeAbsolute > timeout) { + throw new TimeoutException("Timeout of " + timeout + " sec reached. Aborting"); } - long currentTime = System.currentTimeMillis(); - if (currentTime - reportStartTime >= reportIntervalMs) { - long timePassed = currentTime - startTime; - int numQueriesExecutedInt = numQueriesExecuted.get(); - LOGGER.info("Time Passed: {}ms, Queries Executed: {}, Exceptions: {}, Average QPS: {}, " - + "Average Broker Time: {}ms, Average Client Time: {}ms.", timePassed, numQueriesExecutedInt, - numExceptions.get(), numQueriesExecutedInt / ((double) timePassed / MILLIS_PER_SECOND), - totalBrokerTime.get() / (double) numQueriesExecutedInt, - totalClientTime.get() / (double) numQueriesExecutedInt); - reportStartTime = currentTime; - numReportIntervals++; - - if ((numIntervalsToReportAndClearStatistics != 0) && (numReportIntervals - == numIntervalsToReportAndClearStatistics)) { - numReportIntervals = 0; - startTime = currentTime; - reportAndClearStatistics(numQueriesExecuted, numExceptions, totalBrokerTime, totalClientTime, - statisticsList); + for (String query : queries) { + if (timeout > 0 && System.currentTimeMillis() - startTimeAbsolute > timeout) { + throw new TimeoutException("Timeout of " + timeout + " sec reached. Aborting"); + } + while (!queryQueue.offer(query)) { + Thread.sleep(1); + } + + long currentTime = System.currentTimeMillis(); + if (currentTime - reportStartTime >= reportIntervalMs) { + long timePassed = currentTime - startTime; + int numQueriesExecutedInt = numQueriesExecuted.get(); + LOGGER.info("Time Passed: {}ms, Queries Executed: {}, Exceptions: {}, Average QPS: {}, " + "Average " + + "Broker Time: {}ms, Average Client Time: {}ms.", timePassed, numQueriesExecutedInt, + numExceptions.get(), numQueriesExecutedInt / ((double) timePassed / MILLIS_PER_SECOND), + totalBrokerTime.get() / (double) numQueriesExecutedInt, + totalClientTime.get() / (double) numQueriesExecutedInt); + reportStartTime = currentTime; + numReportIntervals++; + + if ((numIntervalsToReportAndClearStatistics != 0) && (numReportIntervals + == numIntervalsToReportAndClearStatistics)) { + numReportIntervals = 0; + startTime = currentTime; + reportAndClearStatistics(numQueriesExecuted, numExceptions, totalBrokerTime, totalClientTime, + statisticsList); + } } } + numTimesExecuted++; } - numTimesExecuted++; + } catch (TimeoutException e) { + LOGGER.info("Time out reached. {}", e.getMessage()); Review Comment: It's not. Event after this change, you'll still get the message `Time out reached. Timeout of 300000 sec reached. Aborting` Prior to this change, after this an exception was thrown and no final statistics were printed. After this change, we stop gracefully ad print the final stats. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org