You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "nastra (via GitHub)" <gi...@apache.org> on 2023/10/17 10:47:37 UTC

[PR] Spark 3.5: Use Awaitility instead of Thread.sleep() [iceberg]

nastra opened a new pull request, #8853:
URL: https://github.com/apache/iceberg/pull/8853

   (no comment)


-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Spark 3.5: Use Awaitility instead of Thread.sleep() [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra merged PR #8853:
URL: https://github.com/apache/iceberg/pull/8853


-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Spark 3.5: Use Awaitility instead of Thread.sleep() [iceberg]

Posted by "nk1506 (via GitHub)" <gi...@apache.org>.
nk1506 commented on code in PR #8853:
URL: https://github.com/apache/iceberg/pull/8853#discussion_r1361945348


##########
spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/source/SparkSQLExecutionHelper.java:
##########
@@ -42,28 +45,26 @@ public static String lastExecutedMetricValue(SparkSession spark, String metricNa
     SQLExecutionUIData lastExecution = statusStore.executionsList().last();
     Option<SQLPlanMetric> sqlPlanMetric =
         lastExecution.metrics().find(metric -> metric.name().equals(metricName));
-    Assert.assertTrue(
-        String.format("Metric '%s' not found in last execution", metricName),
-        sqlPlanMetric.isDefined());
+    assertThat(sqlPlanMetric.isDefined())
+        .as(String.format("Metric '%s' not found in last execution", metricName))
+        .isTrue();
     long metricId = sqlPlanMetric.get().accumulatorId();
 
     // Refresh metricValues, they will remain null until the execution is complete and metrics are
     // aggregated
-    int attempts = 3;
-    while (lastExecution.metricValues() == null && attempts > 0) {
-      try {
-        Thread.sleep(100);
-        attempts--;
-      } catch (InterruptedException e) {
-        throw new RuntimeException(e);
-      }
+    Awaitility.await()

Review Comment:
   nit: is it a good idea to add some alias with `Awaitility` here? 



-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Spark 3.5: Use Awaitility instead of Thread.sleep() [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #8853:
URL: https://github.com/apache/iceberg/pull/8853#discussion_r1362301067


##########
spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/source/SparkSQLExecutionHelper.java:
##########
@@ -42,28 +45,26 @@ public static String lastExecutedMetricValue(SparkSession spark, String metricNa
     SQLExecutionUIData lastExecution = statusStore.executionsList().last();
     Option<SQLPlanMetric> sqlPlanMetric =
         lastExecution.metrics().find(metric -> metric.name().equals(metricName));
-    Assert.assertTrue(
-        String.format("Metric '%s' not found in last execution", metricName),
-        sqlPlanMetric.isDefined());
+    assertThat(sqlPlanMetric.isDefined())
+        .as(String.format("Metric '%s' not found in last execution", metricName))
+        .isTrue();
     long metricId = sqlPlanMetric.get().accumulatorId();
 
     // Refresh metricValues, they will remain null until the execution is complete and metrics are
     // aggregated
-    int attempts = 3;
-    while (lastExecution.metricValues() == null && attempts > 0) {
-      try {
-        Thread.sleep(100);
-        attempts--;
-      } catch (InterruptedException e) {
-        throw new RuntimeException(e);
-      }
+    Awaitility.await()

Review Comment:
   in certain cases it makes sense to add an alias, but here I think we should be ok, since there's a comment right above that explains what's being 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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org