-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a threadpool to Qualification tool to process logs in parallel #2841
Conversation
Signed-off-by: Thomas Graves <tgraves@nvidia.com>
build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice speedup
.setDaemon(true).setNameFormat("qualTool" + "-%d").build() | ||
logInfo(s"Threadpool size is $nThreads") | ||
private val threadPool = Executors.newFixedThreadPool(nThreads, threadFactory) | ||
.asInstanceOf[ThreadPoolExecutor] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: redundant cast?
threadPool.shutdown() | ||
if (!threadPool.awaitTermination(waitTimeInSec, TimeUnit.SECONDS)) { | ||
logError(s"Processing log files took longer then $waitTimeInSec seconds," + | ||
" stopping processing any more event logs") | ||
threadPool.shutdownNow() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may get an InterruptedException in awaitTermination, may want to surround it with try/finally and place shutdownNow into finally.
None | ||
case e: Exception => | ||
// catch all exceptions and skip that file | ||
logWarning(s"Got unexpected exception processing file: $path", e) | ||
logWarning(s"Got unexpected exception processing file: ${path.eventLog.toString}", e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: toString is redundant
Add a threadpool and parameters to configure timeout and number of threads (defaults to cores on host/4).
Updated some log messages so it shows path or something useful since now the log messages don't come out in sequential order.
Fixed a bug with printing out the text file when there aren't any apps in QualOutputWriter.
Times to process 105 log files went from about 6.5 minutes to 45 seconds, interestingly enough, processing 210 log files only takes a bit longer at like 50 seconds, it looks like a few of the log files are skewed and take much longer than others.