Skip to content

Conversation

@liutang123
Copy link
Contributor

What changes were proposed in this pull request?

check spark.task.cpus before creating TaskScheduler in SparkContext

How was this patch tested?

UT

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

@liutang123
Copy link
Contributor Author

@srowen @dongjoon-hyun
Thanks for reviewing.
I solved some of the test failures.

@SparkQA
Copy link

SparkQA commented Mar 31, 2019

Test build #4672 has started for PR 24261 at commit 0e2ec60.

@dongjoon-hyun
Copy link
Member

dongjoon-hyun commented Mar 31, 2019

Thank you, @liutang123 . BTW, the previous one fails due to the time-out in R unit test. I'll retrigger the test.

@dongjoon-hyun
Copy link
Member

Retest this please.

@SparkQA
Copy link

SparkQA commented Apr 1, 2019

Test build #104148 has finished for PR 24261 at commit 0e2ec60.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@srowen srowen left a comment

Choose a reason for hiding this comment

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

@dongjoon-hyun as a double check this time does it look reasonable?

Copy link
Member

Choose a reason for hiding this comment

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

I don't know if that comment is necessary, and I suppose you could write s"local[$taskCpus]" here. But seems OK with me overall.

@dongjoon-hyun
Copy link
Member

dongjoon-hyun commented Apr 1, 2019

Oh, sure. @srowen . I'll take a look today, too. Thanks.

throw new SparkException(
s"${EXECUTOR_CORES.key} must not be less than ${CPUS_PER_TASK.key}.")
}
}
Copy link
Member

Choose a reason for hiding this comment

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

What's the difference between this and checkCpusPerTask ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can see the difference at #24131 's discuss.

def checkCpusPerTask(
clusterMode: Boolean,
maxCoresPerExecutor: Option[Int]): Unit = {
val cpusPerTask = sc.conf.get(CPUS_PER_TASK)
Copy link
Member

Choose a reason for hiding this comment

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

Missing contains check, here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Ngone51 CPUS_PER_TASK has default value 1, so, contains check is not needed.

@dongjoon-hyun
Copy link
Member

Retest this please.

if (clusterMode && sc.conf.contains(EXECUTOR_CORES)) {
if (sc.conf.get(EXECUTOR_CORES) < cpusPerTask) {
throw new SparkException(s"${CPUS_PER_TASK.key}" +
s" must be <= ${EXECUTOR_CORES.key} when run on $master.")
Copy link
Member

Choose a reason for hiding this comment

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

why is $master relevant here? I see we only check clusterMode

} else if (maxCoresPerExecutor.isDefined) {
if (maxCoresPerExecutor.get < cpusPerTask) {
throw new SparkException(s"Only ${maxCoresPerExecutor.get} cores available per executor" +
s" when run on $master, and ${CPUS_PER_TASK.key} must be <= it.")
Copy link
Member

Choose a reason for hiding this comment

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

ditto about $master

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Max cores per executor is 3 when run on local[3] mode, and is 1 when run on local mode. I think we should info user that witch master he or she used.

@SparkQA
Copy link

SparkQA commented Apr 3, 2019

Test build #104254 has finished for PR 24261 at commit 84f6e57.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@srowen srowen left a comment

Choose a reason for hiding this comment

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

@dongjoon-hyun @felixcheung I'll merge this tomorrow if you're OK

@srowen
Copy link
Member

srowen commented Apr 5, 2019

Merged to master

@srowen srowen closed this in 39f75b4 Apr 5, 2019
Sign up for free to 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.

6 participants