Github user kayousterhout commented on a diff in the pull request:
https://github.com/apache/spark/pull/6750#discussion_r33993041
--- Diff:
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala ---
@@ -163,6 +163,15 @@ private[spark] class TaskSchedulerImpl(
this.synchronized {
val manager = createTaskSetManager(taskSet, maxTaskFailures)
activeTaskSets(taskSet.id) = manager
+ val stage = taskSet.stageId
+ val conflictingTaskSet = activeTaskSets.exists { case (id, ts) =>
+ // if the id matches, it really should be the same taskSet, but in
some unit tests
+ // we add new taskSets with the same id
+ id != taskSet.id && !ts.isZombie && ts.stageId == stage
+ }
+ if (conflictingTaskSet) {
+ throw new SparkIllegalStateException(s"more than one active
taskSet for stage $stage")
+ }
--- End diff --
What if you change activeTaskSets to be keyed on the stageId? That seems
pretty easy to do and would make this check O(1) rather than O(N)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]