Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-4626] Kill a task only if the executorId is (still) registered with the scheduler #3483

Closed
wants to merge 2 commits into from

Conversation

roxchkplusony
Copy link
Contributor

No description provided.

@roxchkplusony
Copy link
Contributor Author

I largely stole the structure from the status update message handler.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@andrewor14
Copy link
Contributor

add to whitelist

case None =>
// Ignoring the task kill since the executor is not registered.
logWarning(s"Ignored task kill $taskId $executorId"
+ " for unknown executor $sender with ID $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 message is unclear. How about just

"Attempted to kill task $taskId for unknown executor $executorId."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no problem doing that. Do you think StatusUpdate's message is clear as-is?

@SparkQA
Copy link

SparkQA commented Nov 26, 2014

Test build #23902 has started for PR 3483 at commit 5e7fdea.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 26, 2014

Test build #23902 has finished for PR 3483 at commit 5e7fdea.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23902/
Test PASSed.

@SparkQA
Copy link

SparkQA commented Nov 26, 2014

Test build #23907 has started for PR 3483 at commit aba9184.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 26, 2014

Test build #23907 has finished for PR 3483 at commit aba9184.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23907/
Test PASSed.

@pwendell
Copy link
Contributor

LGTM

case None =>
// Ignoring the task kill since the executor is not registered.
logWarning(s"Attempted to kill task $taskId for unknown executor $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'd prefer to avoid pattern matching on Option, so:

executorDataMap.get(executorId).map { executorInfo =>
  executorInfo.executorActor ! KillTask(taskId, executorId, interruptThread)
} getOrElse { 
  logWarning(s"Attempted to kill task $taskId for unknown executor $executorId.")
}

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO the current approach is more explicit and readable, even if someone is not a scala expert. Using getOrElse to just have a side effect of printing a log statement is also a bit awkward.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understand the general objection (pattern matching is usually a cop-out to better functional style) but that's not the appropriate pattern here. map is specifically designed to apply a morphism from A -> B (in Scala, f: A => B) to describe Option[A] -> Option[B]. What we are doing here is applying a choice of side effect, not a value, depending on the concrete Option. The example is (Option[A] -> Option[Unit]) -> Unit with misuse of monadic operators. Also, this code applies patterns found consistently elsewhere in this class file. If you believe strongly in this pattern, would you mind opening a PR for review?

Copy link
Contributor

Choose a reason for hiding this comment

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

Curiosu what others think on this style point (@rxin)?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I don't feel all that strongly about it, but neither does it strike me as awkward or a misuse of monadic operators. Unit is a perfectly valid return type, and this is just idiomatic Scala -- which I prefer to use consistently over Scala written for non-Scala programmers.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about

        val executorInfoOpt = executorDataMap.get(executorId)
        if (executorInfoOpt.isDefined) {
          executorInfoOpt.get.executorActor ! KillTask(taskId, executorId, interruptThread)
        } else {
          // Ignoring the task kill since the executor is not registered.
          logWarning(s"Attempted to kill task $taskId for unknown executor $executorId.")
        }

:)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like it less, but it's a close number two next to the existing pattern. I wouldn't object to keeping them the same or moving to your pattern.

@roxchkplusony
Copy link
Contributor Author

At this point, the merits of the change have disappeared from discussion and now we're onto style questions. Since this change does not diverge from existing patterns, can we move forward? Anyone who cares enough about the style question is free to make a separate PR. Is there anything left to do before accepting or rejecting this PR?

@markhamstra
Copy link
Contributor

Separating style from substance and making purely stylistic PRs is not really a good idea. That only serves to complicate the revision history and make the backtracking of substantive changes more difficult. It's better to get the form and the content right at the same time in a single PR.

@rxin
Copy link
Contributor

rxin commented Nov 27, 2014

I'm fine with the current style actually.

@rxin
Copy link
Contributor

rxin commented Nov 27, 2014

Merging in master & branch-1.2 so this can make the first 1.2 rc.

asfgit pushed a commit that referenced this pull request Nov 27, 2014
… with the scheduler

Author: roxchkplusony <roxchkplusony@gmail.com>

Closes #3483 from roxchkplusony/bugfix/4626 and squashes the following commits:

aba9184 [roxchkplusony] replace warning message per review
5e7fdea [roxchkplusony] [SPARK-4626] Kill a task only if the executorId is (still) registered with the scheduler

(cherry picked from commit 84376d3)
Signed-off-by: Reynold Xin <rxin@databricks.com>
@asfgit asfgit closed this in 84376d3 Nov 27, 2014
@rxin
Copy link
Contributor

rxin commented Nov 27, 2014

Victor - would you be interested in submitting a patch against branch-1.1 as well?

@roxchkplusony
Copy link
Contributor Author

Thanks @rxin! Style-wise I agree. Funny that you put up another alternative :-P

@roxchkplusony
Copy link
Contributor Author

Gladly, after a little break and a chance to figure out upstream branches... lol.

@roxchkplusony roxchkplusony deleted the bugfix/4626 branch November 28, 2014 06:58
asfgit pushed a commit that referenced this pull request Nov 28, 2014
…) registered with the scheduler

v1.1 backport for #3483

Author: roxchkplusony <roxchkplusony@gmail.com>

Closes #3503 from roxchkplusony/bugfix/4626-1.1 and squashes the following commits:

234d350 [roxchkplusony] [SPARK-4626] Kill a task only if the executorId is (still) registered with the scheduler
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.

7 participants