陈梓立 created FLINK-10385:
---------------------------
Summary: Implement a waitUntilCondition utils
Key: FLINK-10385
URL:
https://issues.apache.org/jira/browse/FLINK-10385 Project: Flink
Issue Type: Improvement
Components: Tests
Affects Versions: 1.7.0
Reporter: 陈梓立
Fix For: 1.7.0
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]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)