You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by kmaehashi <gi...@git.apache.org> on 2014/11/18 06:41:41 UTC
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
GitHub user kmaehashi opened a pull request:
https://github.com/apache/spark/pull/3337
[SPARK-4470] Validate number of threads in local mode
When running Spark locally, if number of threads is specified as 0 (e.g., `spark-submit --master local[0] ...`), the job got stuck and does not run at all.
I think it's better to validate the parameter.
Fix for [SPARK-4470](https://issues.apache.org/jira/browse/SPARK-4470).
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kmaehashi/spark spark-4470
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/3337.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #3337
----
commit 7716734721d1cd5704af64e64031ff61f2de5565
Author: Kenichi Maehashi <we...@kenichimaehashi.com>
Date: 2014-11-18T05:30:54Z
SPARK-4470: Validate number of threads in local mode
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63705096
I'm merging this into master and 1.2 thanks.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63584551
[Test build #23586 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/23586/consoleFull) for PR 3337 at commit [`3ad76f3`](https://github.com/apache/spark/commit/3ad76f342bd51a8ce9c7db40bbec68f609bcb985).
* This patch merges cleanly.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63584300
ok to test
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63603101
I see. I think we can punt adding a feature for negative indices to JIRA or another patch, and I wouldn't block this fix on getting consensus around that design (this fix clearly is a strict improvement on what is there). However, that could be a good idea to add something fancy for negative numbers.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63590086
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23586/
Test PASSed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by kmaehashi <gi...@git.apache.org>.
Github user kmaehashi commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63581044
@sryza Thanks for review, fixed as proposed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by sryza <gi...@git.apache.org>.
Github user sryza commented on a diff in the pull request:
https://github.com/apache/spark/pull/3337#discussion_r20523815
--- Diff: core/src/main/scala/org/apache/spark/SparkContext.scala ---
@@ -1805,6 +1805,9 @@ object SparkContext extends Logging {
def localCpuCount = Runtime.getRuntime.availableProcessors()
// local[*] estimates the number of cores on the machine; local[N] uses exactly N threads.
val threadCount = if (threads == "*") localCpuCount else threads.toInt
+ if (threadCount <= 0) {
+ throw new SparkException("Asked to run locally with %d threads".format(threadCount))
--- End diff --
This can be written a little more concisely in Scala as
`s"Asked to run locally with $threadCount threads"`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63425422
Can one of the admins verify this patch?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63590083
[Test build #23586 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/23586/consoleFull) for PR 3337 at commit [`3ad76f3`](https://github.com/apache/spark/commit/3ad76f342bd51a8ce9c7db40bbec68f609bcb985).
* This patch **passes all tests**.
* This patch merges cleanly.
* This patch adds no public classes.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by futurely <gi...@git.apache.org>.
Github user futurely commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63600545
I propose to handle all the possible integer gracefully. Joblib's semantics is not perfect. Positive numbers bigger than the number of CPUs are not validated and zero has no proper meaning. It's also not intuitive why a negative n_jobs leads to `n_cpus + 1 + n_jobs` instead of `n_cpus + n_jobs`. When there are more jobs than available CPUs, over-subscription reduces overall performance.
Here's a better integrated semenatics: `min(n_cpus, n_jobs > 0 ? n_jobs : n_cpus - n_jobs)`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by futurely <gi...@git.apache.org>.
Github user futurely commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63595668
Personally, I prefer the way [how joblib handles negative number of parallel jobs](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/externals/joblib/parallel.py#L190).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/spark/pull/3337
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-4470] Validate number of threads in loc...
Posted by pwendell <gi...@git.apache.org>.
Github user pwendell commented on the pull request:
https://github.com/apache/spark/pull/3337#issuecomment-63598789
@futurely is your suggestion related to this patch specifically (semantics of passing "0") or just proposing an overhaul of our semantics in general? I noticed that joblib doesn't specify the behavior for 0 in the documentation you provided.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org