-
Notifications
You must be signed in to change notification settings - Fork 374
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
[CELEBORN-1838] Interrupt spark task should not report fetch failure #3070
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QQ: Does the
TimeoutException
only happen in the speculation task?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A timeout Exception might happen if there is something wrong with the driver or the executor.
If the executor has something wrong, it might encounter a timeout exception which we will want the task to retry itself.
If the driver has something wrong, throw fetch failure might not be able to save the situation.
So in the current implementation, we assume that all timeout exceptions should be treated as normal exceptions and let the task retry itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the current target branch is barnch-0.5, should it be main?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the main branch has your PR, this problem does not exist in the main branch. So the PR won't be cherry-picked to the main branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems #2921 can handle the
InterruptedException
, but can not cover theTimeoutException
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, maybe another PR for the main to cover the timeout exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be fine to backport the whole patch to main branch.