Skip to content
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

[Infra] [Spark] Improve delta-spark test assignment / distribution among CI Shards / Groups [Attempt 2] #3715

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/spark_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
# These Scala versions must match those in the build.sbt
scala: [2.12.18, 2.13.13]
# Important: This list of shards must be [0..NUM_SHARDS - 1]
shard: [0, 1, 2]
shard: [0, 1, 2, 3]
env:
SCALA_VERSION: ${{ matrix.scala }}
# Important: This must be the same as the length of shards in matrix
NUM_SHARDS: 3
NUM_SHARDS: 4
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v4
Expand Down
8 changes: 6 additions & 2 deletions project/TestParallelization.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import scala.util.Random
import scala.util.hashing.MurmurHash3

import sbt.Keys._
import sbt._

Expand Down Expand Up @@ -146,13 +149,14 @@ object TestParallelization {
}

val testIsAssignedToShard =
math.abs(testDefinition.name.hashCode % numShards.get) == shardId.get
math.abs(MurmurHash3.stringHash(testDefinition.name) % numShards.get) == shardId.get

if(!testIsAssignedToShard) {
return new SimpleHashStrategy(groups, shardId)
}
}

val groupIdx = math.abs(testDefinition.name.hashCode % groupCount)
val groupIdx = math.abs(MurmurHash3.stringHash(testDefinition.name) % groupCount)
val currentGroup = groups(groupIdx)
val updatedGroup = currentGroup.withTests(
currentGroup.tests :+ testDefinition
Expand Down
Loading