use of org.apache.hive.ptest.api.response.TestStatusResponse in project hive by apache.
the class ExecutionController method testStatus.
@RequestMapping(value = "/testStatus", method = RequestMethod.POST)
@ResponseBody
public TestStatusResponse testStatus(@RequestBody TestStopRequest stopRequest, BindingResult result) {
String testHandle = stopRequest.getTestHandle();
Test test = mTests.get(testHandle);
if (result.hasErrors() || Strings.nullToEmpty(stopRequest.getTestHandle()).trim().isEmpty() || test == null) {
return new TestStatusResponse(Status.illegalArgument());
}
return new TestStatusResponse(Status.ok(), test.toTestStatus());
}
use of org.apache.hive.ptest.api.response.TestStatusResponse 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());
}
Aggregations