Skip to content

Add the validation of spark.cores.max under Streaming - #18948

Closed
SOmeONee wants to merge 1 commit into
apache:masterfrom
SOmeONee:master
Closed

Add the validation of spark.cores.max under Streaming#18948
SOmeONee wants to merge 1 commit into
apache:masterfrom
SOmeONee:master

Conversation

@SOmeONee

Copy link
Copy Markdown

What changes were proposed in this pull request?

By using spark streaming, --total-executor-cores must greater than 1.
This pull requst add the validation of spark.cores.max.

How was this patch tested?

manual tests:
--total-executor-cores 1
--total-executor-cores 2

Please review http://spark.apache.org/contributing.html before opening a pull request.

@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

@srowen

Copy link
Copy Markdown
Member

I don't think that's valid. It doesn't catch all cases where you need > 1 core, and isn't necessary for cases that don't involve receivers, I think.

@SOmeONee

Copy link
Copy Markdown
Author

To example NetworkWordCount, if run with '--total-executor-cores 1', it can' be success.

@srowen

Copy link
Copy Markdown
Member

That's not the problem -- I'm saying there are cases where 1 is valid. There are obviously cases where it isn't. But your change makes them all fail.

@SOmeONee

Copy link
Copy Markdown
Author

Ok, sorry, I'ill review it, thanks.

}

if (sc.conf.contains("spark.cores.max")) {
val totalCores = sc.conf.getInt("spark.cores.max", 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, "spark.cores.max" is not set by default, with your change it will always return 1 if not set and throws exception as you wrote.

Besides if there're several receivers in streaming application, even > 1 is not sufficient. So simply checking "spark.cores.max" is not a feasible way to address the issue, and there may not be a good way to handle this problem properly, so I'd suggest to leave the current code as it is.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config spark.cores.max is used to limit the max number of cores that a single executor can require, and as @jerryshao pointed out, it's not set by default. I'm not convinced that validating the config can benefit your issue.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jerryshao spark.cores.max will be returned only when conf contain it.
Here is the biggest possibility to make a judgment.

@jerryshaojerryshaoAug 17, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SOmeONee I'm not quite following your comment here. You assume that default value is "1" which changes the semantics of this configuration. What's more, checking whether "<=1" is not so sufficient as I mentioned above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jiangxb1987 "spark.cores.max" is per application configuration to limit the numbers of cores can be requested for this application, it is not a per executor limitation.

The config spark.cores.max is used to limit the max number of cores that a single executor can require

So still if we have 2 receivers in one streaming application, the minimum number should > 2, checking "1" here is still not feasible.

Since receiver number can only be gotten in run-time, checking configuration will not be worked as expected.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, seems the validation here is not very useful.

@SOmeONee

Copy link
Copy Markdown
Author

@srowen I reviewed again and run the tests, there are no test cases with spark.cores.max=1 in streaming

@jerryshao

Copy link
Copy Markdown
Contributor

The patch here is not solid, we will not merge it unless you have better solution.

srowen added a commit to srowen/spark that referenced this pull request Sep 12, 2017
@srowensrowen mentioned this pull request Sep 12, 2017
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
Closesapache#18522Closesapache#17722Closesapache#18879Closesapache#18891Closesapache#18806Closesapache#18948Closesapache#18949Closesapache#19070Closesapache#19039Closesapache#19142Closesapache#18515Closesapache#19154Closesapache#19162Closesapache#19187Closesapache#19091
Author: Sean Owen <sowen@cloudera.com>
Closesapache#19203 from srowen/CloseStalePRs3.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@SOmeONee@AmplabJenkins@srowen@jerryshao@jiangxb1987