Search in sources :

Example 1 with TestStatusRequest

use of org.apache.hive.ptest.api.request.TestStatusRequest in project hive by apache.

the class PTestClient method testTailLog.

public boolean testTailLog(String testHandle) throws Exception {
    testHandle = Strings.nullToEmpty(testHandle).trim();
    if (testHandle.isEmpty()) {
        throw new IllegalArgumentException("TestHandle is required");
    }
    TestStatusRequest statusRequest = new TestStatusRequest(testHandle);
    TestStatusResponse statusResponse;
    do {
        TimeUnit.SECONDS.sleep(5);
        statusResponse = post(statusRequest, true);
    } while (Status.isPending(statusResponse.getTestStatus().getStatus()));
    long offset = 0;
    do {
        long length = statusResponse.getTestStatus().getLogFileLength();
        if (length > offset) {
            offset = printLogs(testHandle, offset);
        } else {
            TimeUnit.SECONDS.sleep(5);
        }
        statusResponse = post(statusRequest, true);
    } while (Status.isInProgress(statusResponse.getTestStatus().getStatus()));
    while (offset < statusResponse.getTestStatus().getLogFileLength()) {
        offset = printLogs(testHandle, offset);
    }
    Status.assertOKOrFailed(statusResponse.getTestStatus().getStatus());
    return Status.isOK(statusResponse.getTestStatus().getStatus());
}
Also used : TestStatusResponse(org.apache.hive.ptest.api.response.TestStatusResponse) TestStatusRequest(org.apache.hive.ptest.api.request.TestStatusRequest)

Aggregations

TestStatusRequest (org.apache.hive.ptest.api.request.TestStatusRequest)1 TestStatusResponse (org.apache.hive.ptest.api.response.TestStatusResponse)1