Skip to content

Conversation

@dhruve
Copy link
Contributor

@dhruve dhruve commented Sep 19, 2016

What changes were proposed in this pull request?

We are killing multiple executors together instead of iterating over expensive RPC calls to kill single executor.

How was this patch tested?

Executed sample spark job to observe executors being killed/removed with dynamic allocation enabled.

… contention

[SPARK-17365][Core] Return executorIds which are actually killed while killing multiple executors

Fix import wrap and remove unused import

Add mima exclude and refactor few methods.
@vanzin
Copy link
Contributor

vanzin commented Sep 19, 2016

ok to test

@vanzin
Copy link
Contributor

vanzin commented Sep 19, 2016

add to whitelist

@SparkQA
Copy link

SparkQA commented Sep 19, 2016

Test build #65609 has finished for PR 15152 at commit 5a185d2.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class SparkContext(config: SparkConf) extends Logging

@SparkQA
Copy link

SparkQA commented Sep 20, 2016

Test build #65618 has finished for PR 15152 at commit d779a88.

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

@SparkQA
Copy link

SparkQA commented Sep 20, 2016

Test build #65655 has finished for PR 15152 at commit bef1d1e.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dhruve
Copy link
Contributor Author

dhruve commented Sep 20, 2016

PySpark unit tests failure unrelated.

@dhruve
Copy link
Contributor Author

dhruve commented Sep 20, 2016

retest this please

@SparkQA
Copy link

SparkQA commented Sep 20, 2016

Test build #65675 has finished for PR 15152 at commit bef1d1e.

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

@dhruve
Copy link
Contributor Author

dhruve commented Sep 21, 2016

@vanzin, @tgravescs Can you review these changes.

I will resolve the MiMa exclude merge conflicts once the PR is ready to be accepted - as these are being added often. Thanks.

Copy link
Contributor

@vanzin vanzin left a comment

Choose a reason for hiding this comment

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

Looks ok, a few minor things to fix though.

def killExecutor(executorId: String): Boolean = killExecutors(Seq(executorId))
def killExecutor(executorId: String): Boolean = {
val killedExecutors = killExecutors(Seq(executorId))
killedExecutors.nonEmpty && killedExecutors(0).equals(executorId)
Copy link
Contributor

Choose a reason for hiding this comment

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

I seriously hope the backend is not killing some random executor instead of the one that was asked...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't. Just added an additional check here to be sure. I need to change the short circuit operator here to &.

.filter { id => force || !scheduler.isExecutorBusy(id) }
executorsToKill.foreach { id => executorsPendingToRemove(id) = !replace }

logInfo(s"Requesting to kill filtered executor(s) ${executorsToKill.mkString(", ")}")
Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds weird. The following looks slightly better: "Actual list of executors to be killed is ...".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one sounds better.

val killResponse = adjustTotalExecutors.flatMap(killExecutors)(ThreadUtils.sameThread)

killResponse.flatMap(killSuccessful =>
Future.successful ( if (killSuccessful) executorsToKill else Seq.empty[String])
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: no space before '('

assert(executorsPendingToRemove(manager).contains("2"))
assert(executorsPendingToRemove(manager).contains("3"))
assert(!removeExecutor(manager, "100")) // remove non-existent executors
assert(!(removeExecutors(manager, Seq("101", "102")) == Seq("101", "102")))
Copy link
Contributor

Choose a reason for hiding this comment

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

!= doesn't work?


// Keep removing until the limit is reached
assert(executorsPendingToRemove(manager).isEmpty)
assert(removeExecutors(manager, Seq("1")) == Seq("1"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Use === in all these.


def canCreate(masterURL: String): Boolean = masterURL == "myDummyLocalExternalClusterManager"

override def createTaskScheduler(sc: SparkContext,
Copy link
Contributor

@vanzin vanzin Sep 21, 2016

Choose a reason for hiding this comment

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

style: https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide#SparkCodeStyleGuide-Indentation

Each parameter on a separate line when breaking. Happens in a bunch of methods here.

): Boolean = sc.requestTotalExecutors(numExecutors, localityAwareTasks, hostToLocalTaskCount)

override def requestExecutors(numAdditionalExecutors: Int): Boolean =
sc.requestExecutors(numAdditionalExecutors)
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation

@dhruve
Copy link
Contributor Author

dhruve commented Sep 21, 2016

@vanzin - fixed minor nits and indentation.

@SparkQA
Copy link

SparkQA commented Sep 21, 2016

Test build #65729 has finished for PR 15152 at commit b76147c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class ChiSqSelector @Since(\"2.1.0\") () extends Serializable
    • abstract class CompactibleFileStreamLog[T: ClassTag](
    • class FileStreamSinkLog(
    • case class FileEntry(path: String, timestamp: Timestamp, batchId: Long = NOT_SET)
    • class FileStreamSourceLog(

def killExecutor(executorId: String): Boolean = killExecutors(Seq(executorId))
def killExecutor(executorId: String): Boolean = {
val killedExecutors = killExecutors(Seq(executorId))
killedExecutors.nonEmpty & killedExecutors(0).equals(executorId)
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be short-circuited, otherwise it will throw an exception if the list is empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah! The earlier one was fine. Missed it.

@SparkQA
Copy link

SparkQA commented Sep 22, 2016

Test build #65740 has finished for PR 15152 at commit 3d2fac4.

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

@vanzin
Copy link
Contributor

vanzin commented Sep 22, 2016

LGTM. Merging to master.

@asfgit asfgit closed this in 17b72d3 Sep 22, 2016
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.

3 participants