waitinfuture commented on code in PR #2064:
URL:
https://github.com/apache/incubator-celeborn/pull/2064#discussion_r1388789506
##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/PushDataHandler.scala:
##########
@@ -1246,6 +1197,54 @@ class PushDataHandler(val workerSource: WorkerSource)
extends BaseMessageHandler
}
}
+ private def writeLocalData(
+ fileWriters: Seq[FileWriter],
+ body: ByteBuf,
+ shuffleKey: String,
+ batchOffsets: Option[Array[Int]],
+ writePromise: Option[Promise[Unit]]): Unit = {
+ def writeData(fileWriter: FileWriter, body: ByteBuf, shuffleKey: String):
Unit = {
+ try {
+ fileWriter.write(body)
+ } catch {
+ case e: AlreadyClosedException =>
+ fileWriter.decrementPendingWrites()
+ val (mapId, attemptId) = getMapAttempt(body)
+ val endedAttempt =
+ if (shuffleMapperAttempts.containsKey(shuffleKey)) {
+ shuffleMapperAttempts.get(shuffleKey).get(mapId)
+ } else -1
+ // TODO just info log for ended attempt
+ logWarning(s"Append data failed for task(shuffle $shuffleKey, map
$mapId, attempt" +
+ s" $attemptId), caused by AlreadyClosedException, endedAttempt
$endedAttempt, error message: ${e.getMessage}")
+ writePromise.map(_.failure(e)).orElse(throw e)
+ case e: Exception =>
+ logError("Exception encountered when write.", e)
+ writePromise.map(_.failure(e)).orElse(throw e)
Review Comment:
ditto
##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/PushDataHandler.scala:
##########
@@ -1246,6 +1197,54 @@ class PushDataHandler(val workerSource: WorkerSource)
extends BaseMessageHandler
}
}
+ private def writeLocalData(
+ fileWriters: Seq[FileWriter],
+ body: ByteBuf,
+ shuffleKey: String,
+ batchOffsets: Option[Array[Int]],
+ writePromise: Option[Promise[Unit]]): Unit = {
+ def writeData(fileWriter: FileWriter, body: ByteBuf, shuffleKey: String):
Unit = {
+ try {
+ fileWriter.write(body)
+ } catch {
+ case e: AlreadyClosedException =>
+ fileWriter.decrementPendingWrites()
+ val (mapId, attemptId) = getMapAttempt(body)
+ val endedAttempt =
+ if (shuffleMapperAttempts.containsKey(shuffleKey)) {
+ shuffleMapperAttempts.get(shuffleKey).get(mapId)
+ } else -1
+ // TODO just info log for ended attempt
+ logWarning(s"Append data failed for task(shuffle $shuffleKey, map
$mapId, attempt" +
+ s" $attemptId), caused by AlreadyClosedException, endedAttempt
$endedAttempt, error message: ${e.getMessage}")
+ writePromise.map(_.failure(e)).orElse(throw e)
Review Comment:
Better to wrap into `CelebornIOException` and set the cause to
`PUSH_DATA_WRITE_FAIL_PRIMARY` or `PUSH_DATA_WRITE_FAIL_REPLICA`, like
```
val cause =
if (isPrimary) {
StatusCode.PUSH_DATA_WRITE_FAIL_PRIMARY
} else {
StatusCode.PUSH_DATA_WRITE_FAIL_REPLICA
}
writePromise.map(_.failure(new CelebornIOException(cause)))
```
Client will parse the exception msg and identify the cause in
`ShuffleClientImpl#getPushDataFailCause`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]