Skip to content

Commit

Permalink
dont throw in parallelizeAndComputeWithIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
ehigham committed Nov 1, 2024
1 parent 5642d5f commit 6e36a7a
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions hail/src/main/scala/is/hail/backend/service/ServiceBackend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import is.hail.expr.ir.lowering._
import is.hail.io.fs._
import is.hail.linalg.BlockMatrix
import is.hail.services.{BatchClient, JobGroupRequest, _}
import is.hail.services.JobGroupStates.Failure
import is.hail.services.JobGroupStates.{Cancelled, Failure, Running, Success}
import is.hail.types._
import is.hail.types.physical._
import is.hail.types.physical.stypes.PTypeReferenceSingleCodeType
Expand Down Expand Up @@ -280,18 +280,27 @@ class ServiceBackend(

log.info(s"parallelizeAndComputeWithIndex: $token: reading results")
val startTime = System.nanoTime()
val r @ (error, results) = runAllKeepFirstError(new CancellingExecutorService(executor)) {
var r @ (err, results) = runAllKeepFirstError(new CancellingExecutorService(executor)) {
(partIdxs, parts.indices).zipped.map { (partIdx, jobIndex) =>
(() => readResult(root, jobIndex), partIdx)
}
}

error.foreach(throw _)
if (jobGroup.state != Success && err.isEmpty) {
assert(jobGroup.state != Running)
val error =
jobGroup.state match {
case Failure =>
new HailBatchFailure(
s"Job group ${jobGroup.job_group_id} for batch ${batchConfig.batchId} failed with an unknown error"
)
case Cancelled =>
new CancellationException(
s"Job group ${jobGroup.job_group_id} for batch ${batchConfig.batchId} was cancelled"
)
}

if (jobGroup.state == Failure) {
throw new HailBatchFailure(
s"Job group ${jobGroup.job_group_id} for batch ${batchConfig.batchId} failed with an unknown error"
)
r = (Some(error), results)
}

val resultsReadingSeconds = (System.nanoTime() - startTime) / 1000000000.0
Expand Down

0 comments on commit 6e36a7a

Please sign in to comment.