You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dillitz (via GitHub)" <gi...@apache.org> on 2023/07/03 12:07:18 UTC

[GitHub] [spark] dillitz commented on a diff in pull request #41829: [SPARK-44275][CONNECT] Add configurable retry mechanism to Scala Spark Connect

dillitz commented on code in PR #41829:
URL: https://github.com/apache/spark/pull/41829#discussion_r1250786948


##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/connect/client/SparkConnectClient.scala:
##########
@@ -60,14 +63,40 @@ private[sql] class SparkConnectClient(
     new ArtifactManager(userContext, sessionId, channel)
   }
 
+  private val retryParameters: SparkConnectClient.RetryParameters = configuration.retryParameters
+
+  @tailrec private[client] final def retry[T](fn: => T, retries: Int = 0): T = {
+    if (retries > retryParameters.max_retries) {
+      throw new IllegalArgumentException(s"retries must not exceed retryParameters.max_retries")
+    }
+    Try {
+      fn

Review Comment:
   I chose to retry on no exception by default to not alter the behavior, but I agree, mirroring the Python client here makes more sense!



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org