Github user markhamstra commented on a diff in the pull request:
https://github.com/apache/spark/pull/1528#discussion_r15248491
--- Diff:
core/src/main/scala/org/apache/spark/scheduler/SchedulingAlgorithm.scala ---
@@ -32,11 +32,21 @@ private[spark] class FIFOSchedulingAlgorithm extends
SchedulingAlgorithm {
val priority2 = s2.priority
var res = math.signum(priority1 - priority2)
if (res == 0) {
- val stageId1 = s1.stageId
- val stageId2 = s2.stageId
- res = math.signum(stageId1 - stageId2)
+ val jobId1 = s1.jobId
+ val jobId2 = s2.jobId
+ res = math.signum(jobId1 - jobId2)
+ if (res == 0) {
+ val stageId1 = s1.stageId
+ val stageId2 = s2.stageId
+ res = math.signum(stageId1 - stageId2)
+ }
+ if (res < 0) {
+ true
+ } else {
+ false
+ }
--- End diff --
This `if..else` doesn't actually do anything. This whole comparator is
needlessly complex. If the intent is lexicographical ordering with higher
priority ahead of lower priority, lower jobId ahead of higher jobId, and lower
stageId ahead of higher stageId, then this should be sufficient:
```scala
private[spark] class FIFOSchedulingAlgorithm extends SchedulingAlgorithm {
override def comparator(s1: Schedulable, s2: Schedulable): Boolean = {
import scala.math.Ordering.Implicits._
(s1.priority, s2.jobId, s2.stageId) > (s2.priority, s1.jobId,
s1.stageId)
}
}
```
---
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.
---