Skip to content

Commit

Permalink
[coordinator] Don't abort on deadlock when spliting, use random tie b…
Browse files Browse the repository at this point in the history
…reakers group instead
  • Loading branch information
WojciechMazur committed May 12, 2023
1 parent 2026365 commit 86e7f21
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions coordinator/src/main/scala/buildPlan.scala
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def splitIntoStages(
def hasCyclicDependencies(p: ProjectBuildDef) =
p.dependencies.exists(deps(_).dependencies.contains(p.project))
val cyclicDeps = newRemainings.filter(hasCyclicDependencies)
if cyclicDeps.nonEmpty then
if cyclicDeps.nonEmpty then {
currentStage ++= cyclicDeps
newRemainings --= cyclicDeps
cyclicDeps.foreach(v =>
Expand All @@ -294,13 +294,21 @@ def splitIntoStages(
.filterNot(done.contains)}"
)
)
else
newRemainings.foreach { p =>
println(
s"${p.project.coordinates}: ${p.dependencies.map(_.coordinates).mkString(", ")}"
)
}
sys.error("Deadlock in splitting projects into stages")
} else {
System.err.println(
"Deadlock in splitting projects into stages, joining into single group"
)
newRemainings
.sortBy(_.project)
.foreach { p =>
println(
s"${p.project.coordinates}: ${p.dependencies.map(_.coordinates).mkString(", ")}"
)
}
val tieBreakers = newRemainings.take(25)
currentStage ++= tieBreakers
newRemainings --= tieBreakers
}
}
val names = currentStage.map(_.project)
val currentStages = currentStage.grouped(maxStageSize).toList
Expand Down

0 comments on commit 86e7f21

Please sign in to comment.