Copilot commented on code in PR #7132:
URL: https://github.com/apache/kyuubi/pull/7132#discussion_r2196106119
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala:
##########
@@ -292,13 +292,23 @@ class BatchJobSubmission(
try {
info(s"Submitting $batchType batch[$batchId] job:\n$builder")
val process = builder.start
- while (process.isAlive && !applicationFailed(_applicationInfo,
appOperation)) {
+
+ // continue polling if process is alive and applicationId is not set
+ // or application is not failed
+ while (process.isAlive && (
+ !applicationId(_applicationInfo).isDefined ||
+ !applicationFailed(_applicationInfo, appOperation))) {
doUpdateApplicationInfoMetadataIfNeeded()
process.waitFor(applicationCheckInterval, TimeUnit.MILLISECONDS)
}
Review Comment:
[nitpick] The condition logic is complex and could benefit from extraction
into a helper method like `shouldContinuePolling()` to improve readability and
maintainability.
```suggestion
// continue polling based on the helper method
while (shouldContinuePolling(process)) {
doUpdateApplicationInfoMetadataIfNeeded()
process.waitFor(applicationCheckInterval, TimeUnit.MILLISECONDS)
}
private def shouldContinuePolling(process: Process): Boolean = {
process.isAlive && (
!applicationId(_applicationInfo).isDefined ||
!applicationFailed(_applicationInfo, appOperation)
)
}
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]