Skip to content

Commit

Permalink
Merge pull request alteryx#142 from liancheng/dagscheduler-pattern-ma…
Browse files Browse the repository at this point in the history
…tching

Using case class deep match to simplify code in DAGScheduler.processEvent

Since all `XxxEvent` pushed in `DAGScheduler.eventQueue` are case classes, deep pattern matching is more convenient to extract event object components.

(cherry picked from commit 9f7b9bb)
Signed-off-by: Reynold Xin <[email protected]>
  • Loading branch information
rxin committed Nov 5, 2013
1 parent e80d1cf commit 0848167
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,14 @@ class DAGScheduler(
case ExecutorLost(execId) =>
handleExecutorLost(execId)

case begin: BeginEvent =>
listenerBus.post(SparkListenerTaskStart(begin.task, begin.taskInfo))
case BeginEvent(task, taskInfo) =>
listenerBus.post(SparkListenerTaskStart(task, taskInfo))

case gettingResult: GettingResultEvent =>
listenerBus.post(SparkListenerTaskGettingResult(gettingResult.task, gettingResult.taskInfo))
case GettingResultEvent(task, taskInfo) =>
listenerBus.post(SparkListenerTaskGettingResult(task, taskInfo))

case completion: CompletionEvent =>
listenerBus.post(SparkListenerTaskEnd(
completion.task, completion.reason, completion.taskInfo, completion.taskMetrics))
case completion @ CompletionEvent(task, reason, _, _, taskInfo, taskMetrics) =>
listenerBus.post(SparkListenerTaskEnd(task, reason, taskInfo, taskMetrics))
handleTaskCompletion(completion)

case TaskSetFailed(taskSet, reason) =>
Expand Down

0 comments on commit 0848167

Please sign in to comment.