Use fresh SparkSession when capturing to avoid late capture of previous query #537
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Jason Lowe jlowe@nvidia.com
This hopefully fixes #473.
I believe what's happening in that bug is the test just before the one that fails isn't trying to capture yet the capture callback is still enabled. I suspect the callback on the last test's query is late, occurring while the next test is already running and after it enables the callback capture. That causes it to capture the previous test's GPU run as the CPU run and the subsequent GPU run captures the CPU run instead which explains why we see a CPU plan when it fails.
This updates
runOnCpuAndGpuWithCapture
to force a new Spark session which should drain the listener callbacks during the session stop and should create a hard boundary between the previous test and the next test that is trying to capture. The downside is that using captures will be slower due to the new session being created.