Github user tdas commented on a diff in the pull request:
https://github.com/apache/spark/pull/7385#discussion_r34633775
--- Diff: core/src/main/scala/org/apache/spark/FutureAction.scala ---
@@ -154,17 +143,13 @@ class SimpleFutureAction[T] private[spark](jobWaiter:
JobWaiter[_], resultFunc:
override def isCancelled: Boolean = _cancelled
override def value: Option[Try[T]] = {
- if (jobWaiter.jobFinished) {
- Some(awaitResult())
- } else {
+ if (!isCompleted) {
None
- }
- }
-
- private def awaitResult(): Try[T] = {
- jobWaiter.awaitResult() match {
- case JobSucceeded => scala.util.Success(resultFunc)
- case JobFailed(e: Exception) => scala.util.Failure(e)
+ } else {
+ jobWaiter.awaitResult() match {
--- End diff --
This part seems like a bad hack to use `awaitResult` to get the result.
Rather, there should be a `JobWaiter.jobResult` (make it public), that return
`Option[JobResult]` and use that.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]