use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class OverlordResourceTestClient method getTasks.
private List<TaskResponseObject> getTasks(String identifier) {
try {
StatusResponseHolder response = makeRequest(HttpMethod.GET, StringUtils.format("%s%s", getIndexerURL(), identifier));
LOG.debug("Tasks %s response %s", identifier, response.getContent());
return jsonMapper.readValue(response.getContent(), new TypeReference<List<TaskResponseObject>>() {
});
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class OverlordResourceTestClient method getSupervisorStatus.
public SupervisorStateManager.BasicState getSupervisorStatus(String id) {
try {
StatusResponseHolder response = httpClient.go(new Request(HttpMethod.GET, new URL(StringUtils.format("%ssupervisor/%s/status", getIndexerURL(), StringUtils.urlEncode(id)))), StatusResponseHandler.getInstance()).get();
if (!response.getStatus().equals(HttpResponseStatus.OK)) {
throw new ISE("Error while getting supervisor status, response [%s %s]", response.getStatus(), response.getContent());
}
Map<String, Object> responseData = jsonMapper.readValue(response.getContent(), JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT);
Map<String, Object> payload = jsonMapper.convertValue(responseData.get("payload"), JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT);
String state = (String) payload.get("state");
LOG.debug("Supervisor id[%s] has state [%s]", id, state);
return SupervisorStateManager.BasicState.valueOf(state);
} catch (ISE e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class OverlordResourceTestClient method getSupervisorHealth.
public void getSupervisorHealth(String id) {
try {
StatusResponseHolder response = httpClient.go(new Request(HttpMethod.GET, new URL(StringUtils.format("%ssupervisor/%s/health", getIndexerURL(), StringUtils.urlEncode(id)))), StatusResponseHandler.getInstance()).get();
if (!response.getStatus().equals(HttpResponseStatus.OK)) {
throw new ISE("Error while get supervisor health, response [%s %s]", response.getStatus(), response.getContent());
}
LOG.debug("get supervisor health with id[%s]", id);
} catch (ISE e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class OverlordResourceTestClient method getTaskStatus.
public TaskStatusPlus getTaskStatus(String taskID) {
try {
StatusResponseHolder response = makeRequest(HttpMethod.GET, StringUtils.format("%stask/%s/status", getIndexerURL(), StringUtils.urlEncode(taskID)));
LOG.debug("Index status response" + response.getContent());
TaskStatusResponse taskStatusResponse = jsonMapper.readValue(response.getContent(), new TypeReference<TaskStatusResponse>() {
});
return taskStatusResponse.getStatus();
} catch (ISE e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.druid.java.util.http.client.response.StatusResponseHolder in project druid by druid-io.
the class OverlordResourceTestClient method resumeSupervisor.
public void resumeSupervisor(String id) {
try {
StatusResponseHolder response = httpClient.go(new Request(HttpMethod.POST, new URL(StringUtils.format("%ssupervisor/%s/resume", getIndexerURL(), StringUtils.urlEncode(id)))), StatusResponseHandler.getInstance()).get();
if (!response.getStatus().equals(HttpResponseStatus.OK)) {
throw new ISE("Error while resuming supervisor, response [%s %s]", response.getStatus(), response.getContent());
}
LOG.debug("Resumed supervisor with id[%s]", id);
} catch (ISE e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations