Repository: spark
Updated Branches:
  refs/heads/branch-1.3 6b528dc13 -> 7d0ab5553


[SPARK-6975][Yarn] Fix argument validation error

`numExecutors` checking is failed when dynamic allocation is enabled with 
default configuration. Details can be seen is 
[SPARK-6975](https://issues.apache.org/jira/browse/SPARK-6975). sryza, please 
help me to review this, not sure is this the correct way, I think previous you 
change this part :)

Author: jerryshao <[email protected]>

Closes #5551 from jerryshao/SPARK-6975 and squashes the following commits:

4335da1 [jerryshao] Change according to the comments
77bdcbd [jerryshao] Fix argument validation error

(cherry picked from commit d850b4bd3a294dd245881e03f7f94bf970a7ee79)
Signed-off-by: Andrew Or <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/7d0ab555
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/7d0ab555
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/7d0ab555

Branch: refs/heads/branch-1.3
Commit: 7d0ab55538be4138df1750b0aa73d3066d61fb9b
Parents: 6b528dc
Author: jerryshao <[email protected]>
Authored: Fri Apr 17 19:17:06 2015 -0700
Committer: Andrew Or <[email protected]>
Committed: Fri Apr 17 19:17:19 2015 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/deploy/yarn/ClientArguments.scala | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/7d0ab555/yarn/src/main/scala/org/apache/spark/deploy/yarn/ClientArguments.scala
----------------------------------------------------------------------
diff --git 
a/yarn/src/main/scala/org/apache/spark/deploy/yarn/ClientArguments.scala 
b/yarn/src/main/scala/org/apache/spark/deploy/yarn/ClientArguments.scala
index 3bc7eb1..7843045 100644
--- a/yarn/src/main/scala/org/apache/spark/deploy/yarn/ClientArguments.scala
+++ b/yarn/src/main/scala/org/apache/spark/deploy/yarn/ClientArguments.scala
@@ -102,9 +102,13 @@ private[spark] class ClientArguments(args: Array[String], 
sparkConf: SparkConf)
    * This is intended to be called only after the provided arguments have been 
parsed.
    */
   private def validateArgs(): Unit = {
-    if (numExecutors <= 0) {
+    if (numExecutors < 0 || (!isDynamicAllocationEnabled && numExecutors == 
0)) {
       throw new IllegalArgumentException(
-        "You must specify at least 1 executor!\n" + getUsageMessage())
+        s"""
+           |Number of executors was $numExecutors, but must be at least 1
+           |(or 0 if dynamic executor allocation is enabled).
+           |${getUsageMessage()}
+         """.stripMargin)
     }
     if (executorCores < sparkConf.getInt("spark.task.cpus", 1)) {
       throw new SparkException("Executor cores must not be less than " +


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to