You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (requestedShards >1&& plan.sequence.flows.isNotEmpty()) {
199
-
error("Cannot run sharded tests with sequential execution")
200
-
}
201
-
197
+
val shards = shardSplit ?: shardAll ?:1
202
198
val onlySequenceFlows = plan.sequence.flows.isNotEmpty() && plan.flowsToRun.isEmpty() // An edge case
203
199
204
200
runCatching {
@@ -217,10 +213,15 @@ class TestCommand : Callable<Int> {
217
213
}.toMutableSet())
218
214
219
215
val availableDevices =if (deviceIds.isNotEmpty()) deviceIds.size else initialActiveDevices.size
220
-
val effectiveShards =if (onlySequenceFlows) 1else requestedShards.coerceAtMost(plan.flowsToRun.size)
216
+
val effectiveShards =if (onlySequenceFlows) 1else shards.coerceAtMost(plan.flowsToRun.size)
217
+
val sharded = effectiveShards >1
221
218
222
-
if (requestedShards > plan.flowsToRun.size) {
223
-
PrintUtils.warn("Requested $requestedShards shards, but it cannot be higher than the number of flows (${plan.flowsToRun.size}). Will use $effectiveShards shards instead.")
219
+
if (shards > plan.flowsToRun.size) {
220
+
PrintUtils.warn("Requested $shards shards, but it cannot be higher than the number of flows (${plan.flowsToRun.size}). Will use $effectiveShards shards instead.")
221
+
}
222
+
223
+
if (sharded && plan.sequence.flows.isNotEmpty()) {
224
+
error("Cannot run sharded tests with sequential execution")
224
225
}
225
226
226
227
val chunkPlans:List<ExecutionPlan> =if (onlySequenceFlows) {
@@ -254,7 +255,7 @@ class TestCommand : Callable<Int> {
254
255
"Will split $flowCount flows across $effectiveShards shards (${prefix}$flowsPerShard flows per shard)"
255
256
}
256
257
257
-
else->"Will run $flowCountflows in a single shard"
258
+
else->"Will run $flowCount in a single shard"
258
259
}
259
260
260
261
appendLine(message)
@@ -277,13 +278,9 @@ class TestCommand : Callable<Int> {
277
278
278
279
val results = (0 until effectiveShards).map { shardIndex ->
279
280
async(Dispatchers.IO) {
280
-
val driverHostPort =if (effectiveShards ==1) {
281
-
parent?.port ?:7001
282
-
} else {
283
-
(7001..7128).shuffled().find { port ->
284
-
usedPorts.putIfAbsent(port, true) ==null
285
-
} ?: error("No available ports found")
286
-
}
281
+
val driverHostPort =if (!sharded) parent?.port ?:7001else (7001..7128).shuffled().find { port ->
282
+
usedPorts.putIfAbsent(port, true) ==null
283
+
} ?: error("No available ports found")
287
284
288
285
// Acquire lock to execute device creation block
289
286
deviceCreationSemaphore.acquire()
@@ -383,7 +380,7 @@ class TestCommand : Callable<Int> {
383
380
384
381
suites.mergeSummaries()?.saveReport()
385
382
386
-
if (effectiveShards >1) printShardsMessage(passed, total, suites)
383
+
if (sharded) printShardsMessage(passed, total, suites)
0 commit comments