Skip to content

Commit 3c746ea

Browse files
author
Alexander Bessonov
committed
Catch IllegalArgumentException thrown by new Path in ApplicationMaster
1 parent 0fd84b0 commit 3c746ea

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,12 @@ private[spark] class ApplicationMaster(
534534
try {
535535
val preserveFiles = sparkConf.get(PRESERVE_STAGING_FILES)
536536
if (!preserveFiles) {
537-
stagingDirPath = new Path(System.getenv("SPARK_YARN_STAGING_DIR"))
538-
if (stagingDirPath == null) {
539-
logError("Staging directory is null")
540-
return
537+
try {
538+
stagingDirPath = new Path(System.getenv("SPARK_YARN_STAGING_DIR"))
539+
} catch {
540+
case e: IllegalArgumentException =>
541+
logError("Staging directory is null")
542+
return
541543
}
542544
logInfo("Deleting staging directory " + stagingDirPath)
543545
fs.delete(stagingDirPath, true)

0 commit comments

Comments
 (0)