-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
Conversation
… with the scheduler
I largely stole the structure from the status update message handler. |
Can one of the admins verify this patch? |
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") |
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
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?
Test build #23902 has started for PR 3483 at commit
|
Test build #23902 has finished for PR 3483 at commit
|
Test PASSed. |
Test build #23907 has started for PR 3483 at commit
|
Test build #23907 has finished for PR 3483 at commit
|
Test PASSed. |
LGTM |
case None => | ||
// Ignoring the task kill since the executor is not registered. | ||
logWarning(s"Attempted to kill task $taskId for unknown executor $executorId.") | ||
} |
There was a problem hiding this comment.
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.")
}
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.")
}
:)
There was a problem hiding this comment.
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.
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? |
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. |
I'm fine with the current style actually. |
Merging in master & branch-1.2 so this can make the first 1.2 rc. |
… 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>
Victor - would you be interested in submitting a patch against branch-1.1 as well? |
Thanks @rxin! Style-wise I agree. Funny that you put up another alternative :-P |
Gladly, after a little break and a chance to figure out upstream branches... lol. |
…) 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
No description provided.