Ma77Ball commented on code in PR #5714:
URL: https://github.com/apache/texera/pull/5714#discussion_r3448027906
##########
amber/src/main/scala/org/apache/texera/web/resource/SyncExecutionResource.scala:
##########
@@ -375,6 +375,104 @@ class SyncExecutionResource extends LazyLogging {
}
}
+ /**
+ * Blocks until every target operator's default external result port holds
at least as many rows
+ * as its stats report, or until `timeoutMillis` elapses. Operators with no
result storage are
+ * treated as ready.
+ */
+ private def awaitResultsPersisted(
+ executionId: ExecutionIdentity,
+ executionService: org.apache.texera.web.service.WorkflowExecutionService,
+ targetOperatorIds: List[String],
+ timeoutMillis: Long = 2000L,
+ pollIntervalMillis: Long = 25L
+ ): Unit = {
+ def expectedOutputCount(opId: String): Long =
+ expectedDefaultPortOutputCount(
+ executionService.executionStateStore.statsStore.getState,
+ opId
+ )
+
+ def committedCount(opId: String): Option[Long] =
+ committedDefaultPortCount(
+ op =>
+ WorkflowExecutionsResource
+ .getResultUriByLogicalPortId(executionId, OperatorIdentity(op),
PortIdentity()),
+ uri =>
+ DocumentFactory
+ .openDocument(uri)
+ ._1
+ .asInstanceOf[VirtualDocument[Tuple]]
+ .getCount
+ )(opId)
+
+ awaitUntil(
+ targetOperatorIds,
+ expectedOutputCount,
+ committedCount,
+ timeoutMillis,
+ pollIntervalMillis,
+ () => System.currentTimeMillis(),
Review Comment:
done
--
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]