You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Matthias (Jira)" <ji...@apache.org> on 2020/12/18 11:20:00 UTC
[jira] [Closed] (FLINK-10385) Implement a waitUntilCondition utils
[ https://issues.apache.org/jira/browse/FLINK-10385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matthias closed FLINK-10385.
----------------------------
Resolution: Invalid
The issue is obsolete as there is already such a method in [CommonTestUtils|https://github.com/apache/flink/blob/66adfe3467124bcfdb5f3f69c57036eafecd46d6/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/CommonTestUtils.java#L124].
> Implement a waitUntilCondition utils
> ------------------------------------
>
> Key: FLINK-10385
> URL: https://issues.apache.org/jira/browse/FLINK-10385
> Project: Flink
> Issue Type: Improvement
> Components: Runtime / Coordination, Tests
> Affects Versions: 1.7.0
> Reporter: Zili Chen
> Priority: Major
> Attachments: example.java
>
>
> Recently when I refine some tests, I notice that it is a common requirement to wait until a (stable) condition occur.
> To achieve this, we have {{ExecutionGraphTestUtils#waitUntilJobStatus}} and many. Most of them can simply abstract as
> {code:java}
> public static void waitUntilCondition(SupplierWithException<Boolean, Throwable> conditionSupplier, Deadline deadline) {
> while (deadline.hasTimeLeft()) {
> if (conditionSupplier.get()) { return; }
> Thread.sleep(Math.min(deadline.toMillis(), 500);
> }
> throws new IlleagalStateException("...");
> }
> {code}
>
> I propose to implement such a method to avoid too many utils method scattered to achieve the same purpose.
> Looking forward to your advice. If there is previous code/project already implemented this, I am glad to introduce it.
> cc [~Zentol]
>
> PS: the file attached is some code I found could satisfy this proposal.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)