Skip to content

Commit

Permalink
SPARK-3014. Log a more informative messages in a couple failure scena…
Browse files Browse the repository at this point in the history
…rio...

...s

Author: Sandy Ryza <sandy@cloudera.com>

Closes #1934 from sryza/sandy-spark-3014 and squashes the following commits:

ae19cc1 [Sandy Ryza] SPARK-3014. Log a more informative messages in a couple failure scenarios
  • Loading branch information
sryza authored and tgravescs committed Sep 12, 2014
1 parent 15a5645 commit 1d76796
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.spark.deploy

import java.io.{File, PrintStream}
import java.lang.reflect.InvocationTargetException
import java.lang.reflect.{Modifier, InvocationTargetException}
import java.net.URL

import scala.collection.mutable.{ArrayBuffer, HashMap, Map}
Expand Down Expand Up @@ -323,7 +323,9 @@ object SparkSubmit {
}

val mainMethod = mainClass.getMethod("main", new Array[String](0).getClass)

if (!Modifier.isStatic(mainMethod.getModifiers)) {
throw new IllegalStateException("The main method in the given main class must be static")
}
try {
mainMethod.invoke(null, childArgs.toArray)
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,9 @@ private[spark] class ApplicationMaster(args: ApplicationMasterArguments,
}

val sparkContext = sparkContextRef.get()
assert(sparkContext != null || count >= numTries)
if (sparkContext == null) {
logError(
"Unable to retrieve sparkContext inspite of waiting for %d, numTries = %d".format(
count * waitTime, numTries))
logError(("SparkContext did not initialize after waiting for %d ms. Please check earlier"
+ " log output for errors. Failing the application.").format(numTries * waitTime))
}
sparkContext
}
Expand Down

0 comments on commit 1d76796

Please sign in to comment.