-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CELEBORN-1838] Interrupt spark task should not report fetch failure
What changes were proposed in this pull request? Do not trigger fetch failure if a spark task attempt is interrupted(speculation enabled). Do not trigger fetch failure if the RPC of getReducerFileGroup is timeout. This PR is intended for celeborn-0.5 branch. Why are the changes needed? Avoid unnecessary fetch failures and stage re-runs. Does this PR introduce any user-facing change? NO. How was this patch tested? 1. GA. 2. Manually tested on cluster with spark speculation tasks. Here is the test case ```scala sc.parallelize(1 to 100, 100).flatMap(i => { (1 to 150000).iterator.map(num => num) }).groupBy(i => i, 100) .map(i => { if (i._1 < 5) { Thread.sleep(15000) } i }) .repartition(400).count ``` <img width="1384" alt="截屏2025-01-18 16 16 16" src="https://github.com/user-attachments/assets/adf64857-5773-4081-a7d0-fa3439e751eb" /> <img width="1393" alt="截屏2025-01-18 16 16 22" src="https://github.com/user-attachments/assets/ac9bf172-1ab4-4669-a930-872d009f2530" /> <img width="1258" alt="截屏2025-01-18 16 19 15" src="https://github.com/user-attachments/assets/6a8ff3e1-c1fb-4ef2-84d8-b1fc6eb56fa6" /> <img width="892" alt="截屏2025-01-18 16 17 27" src="https://github.com/user-attachments/assets/f9de3841-f7d4-4445-99a3-873235d4abd0" /> Closes #3070 from FMX/branch-0.5-b1838. Authored-by: mingji <[email protected]> Signed-off-by: Wang, Fei <[email protected]>
- Loading branch information
Showing
9 changed files
with
293 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
...spark-3/src/test/scala/org/apache/spark/shuffle/celeborn/CelebornShuffleReaderSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.spark.shuffle.celeborn | ||
|
||
import java.nio.file.Files | ||
import java.util.concurrent.TimeoutException | ||
|
||
import org.apache.spark.{Dependency, ShuffleDependency, TaskContext} | ||
import org.apache.spark.shuffle.ShuffleReadMetricsReporter | ||
import org.mockito.ArgumentMatchers.any | ||
import org.mockito.Mockito | ||
import org.mockito.Mockito._ | ||
import org.scalatest.funsuite.AnyFunSuite | ||
|
||
import org.apache.celeborn.client.{DummyShuffleClient, ShuffleClient} | ||
import org.apache.celeborn.common.CelebornConf | ||
import org.apache.celeborn.common.exception.CelebornIOException | ||
import org.apache.celeborn.common.identity.UserIdentifier | ||
|
||
class CelebornShuffleReaderSuite extends AnyFunSuite { | ||
|
||
/** | ||
* Due to spark limitations, spark local mode can not test speculation tasks , | ||
* test the method `checkAndReportFetchFailureForUpdateFileGroupFailure` | ||
*/ | ||
test("CELEBORN-1838 test check report fetch failure exceptions ") { | ||
val dependency = Mockito.mock(classOf[ShuffleDependency[Int, Int, Int]]) | ||
val handler = new CelebornShuffleHandle[Int, Int, Int]( | ||
"APP", | ||
"HOST1", | ||
1, | ||
UserIdentifier.apply("a", "b"), | ||
0, | ||
true, | ||
1, | ||
dependency) | ||
val context = Mockito.mock(classOf[TaskContext]) | ||
val metricReporter = Mockito.mock(classOf[ShuffleReadMetricsReporter]) | ||
val conf = new CelebornConf() | ||
|
||
val tmpFile = Files.createTempFile("test", ".tmp").toFile | ||
mockStatic(classOf[ShuffleClient]).when(() => | ||
ShuffleClient.get(any(), any(), any(), any(), any(), any())).thenReturn( | ||
new DummyShuffleClient(conf, tmpFile)) | ||
|
||
val shuffleReader = | ||
new CelebornShuffleReader[Int, Int](handler, 0, 0, 0, 0, context, conf, metricReporter, null) | ||
|
||
val exception1: Throwable = new CelebornIOException("test1", new InterruptedException("test1")) | ||
val exception2: Throwable = new CelebornIOException("test2", new TimeoutException("test2")) | ||
val exception3: Throwable = new CelebornIOException("test3") | ||
val exception4: Throwable = new CelebornIOException("test4") | ||
|
||
try { | ||
shuffleReader.checkAndReportFetchFailureForUpdateFileGroupFailure(0, exception1) | ||
} catch { | ||
case _: Throwable => | ||
} | ||
try { | ||
shuffleReader.checkAndReportFetchFailureForUpdateFileGroupFailure(0, exception2) | ||
} catch { | ||
case _: Throwable => | ||
} | ||
try { | ||
shuffleReader.checkAndReportFetchFailureForUpdateFileGroupFailure(0, exception3) | ||
} catch { | ||
case _: Throwable => | ||
} | ||
assert( | ||
shuffleReader.shuffleClient.asInstanceOf[DummyShuffleClient].fetchFailureCount.get() === 1) | ||
try { | ||
shuffleReader.checkAndReportFetchFailureForUpdateFileGroupFailure(0, exception4) | ||
} catch { | ||
case _: Throwable => | ||
} | ||
assert( | ||
shuffleReader.shuffleClient.asInstanceOf[DummyShuffleClient].fetchFailureCount.get() === 2) | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.