-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[SPARK-20465][CORE] Throws a proper exception when any temp directory could not be got #17768
Conversation
…when temp directories could not be got/created
Test build #76171 has started for PR 17768 at commit |
Test build #76172 has started for PR 17768 at commit |
This actually also happens when the directory exists but the user does not have the permission. |
@JoshRosen, could you take a look and see if it makes sense? |
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.
Seems reasonable to me vs failing with a less clear exception
val message = intercept[IOException] { | ||
Utils.getLocalDir(conf) | ||
}.getMessage | ||
assert(message === |
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.
I would only suggest not testing the exact message here, but it's not a big deal. Maybe testing for the existence of the paths.
Thank you @srowen. |
Test build #76175 has finished for PR 17768 at commit
|
retest this please |
1 similar comment
retest this please |
Test build #76177 has finished for PR 17768 at commit
|
Test build #76186 has finished for PR 17768 at commit
|
Test build #3679 has finished for PR 17768 at commit
|
retest this please |
Test build #76199 has finished for PR 17768 at commit
|
retest this please |
Current status: I don't know how using val dirs = Array.empty[Int]
dirs.headOption.getOrElse {
throw new Exception("")
} instead of val dirs = Array.empty[Int]
dirs(0) could make the tests failed (given the observations above). val dirs = Array.empty[Int]
if (dirs.nonEmpty) {
dirs(0)
} else {
throw new Exception("")
} in order to make sure logically this should not make other tests flaky. |
Test build #76213 has finished for PR 17768 at commit
|
Test build #76215 has finished for PR 17768 at commit
|
It looks we should clean up the cached local dirs after the test. The newly added test sets it empty path and it seems affecting the tests afterwards. I changed it back to the original proposal with the cleanup. |
retest this please |
Test build #76225 has finished for PR 17768 at commit
|
Test build #76231 has finished for PR 17768 at commit
|
Merged to master/2.2 |
… could not be got ## What changes were proposed in this pull request? This PR proposes to throw an exception with better message rather than `ArrayIndexOutOfBoundsException` when temp directories could not be created. Running the commands below: ```bash ./bin/spark-shell --conf spark.local.dir=/NONEXISTENT_DIR_ONE,/NONEXISTENT_DIR_TWO ``` produces ... **Before** ``` Exception in thread "main" java.lang.ExceptionInInitializerError ... Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 ... ``` **After** ``` Exception in thread "main" java.lang.ExceptionInInitializerError ... Caused by: java.io.IOException: Failed to get a temp directory under [/NONEXISTENT_DIR_ONE,/NONEXISTENT_DIR_TWO]. ... ``` ## How was this patch tested? Unit tests in `LocalDirsSuite.scala`. Author: hyukjinkwon <[email protected]> Closes #17768 from HyukjinKwon/throws-temp-dir-exception. (cherry picked from commit 8c911ad) Signed-off-by: Sean Owen <[email protected]>
What changes were proposed in this pull request?
This PR proposes to throw an exception with better message rather than
ArrayIndexOutOfBoundsException
when temp directories could not be created.Running the commands below:
produces ...
Before
After
How was this patch tested?
Unit tests in
LocalDirsSuite.scala
.