Search in sources :

Example 46 with ISE

use of org.apache.druid.java.util.common.ISE 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);
    }
}
Also used : Request(org.apache.druid.java.util.http.client.Request) StatusResponseHolder(org.apache.druid.java.util.http.client.response.StatusResponseHolder) ISE(org.apache.druid.java.util.common.ISE) URL(java.net.URL)

Example 47 with ISE

use of org.apache.druid.java.util.common.ISE 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);
    }
}
Also used : TaskStatusResponse(org.apache.druid.client.indexing.TaskStatusResponse) StatusResponseHolder(org.apache.druid.java.util.http.client.response.StatusResponseHolder) ISE(org.apache.druid.java.util.common.ISE)

Example 48 with ISE

use of org.apache.druid.java.util.common.ISE 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);
    }
}
Also used : Request(org.apache.druid.java.util.http.client.Request) StatusResponseHolder(org.apache.druid.java.util.http.client.response.StatusResponseHolder) ISE(org.apache.druid.java.util.common.ISE) URL(java.net.URL)

Example 49 with ISE

use of org.apache.druid.java.util.common.ISE in project druid by druid-io.

the class OverlordResourceTestClient method resetSupervisor.

public void resetSupervisor(String id) {
    try {
        StatusResponseHolder response = httpClient.go(new Request(HttpMethod.POST, new URL(StringUtils.format("%ssupervisor/%s/reset", getIndexerURL(), StringUtils.urlEncode(id)))), StatusResponseHandler.getInstance()).get();
        if (!response.getStatus().equals(HttpResponseStatus.OK)) {
            throw new ISE("Error while resetting supervisor, response [%s %s]", response.getStatus(), response.getContent());
        }
        LOG.debug("Reset supervisor with id[%s]", id);
    } catch (ISE e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : Request(org.apache.druid.java.util.http.client.Request) StatusResponseHolder(org.apache.druid.java.util.http.client.response.StatusResponseHolder) ISE(org.apache.druid.java.util.common.ISE) URL(java.net.URL)

Example 50 with ISE

use of org.apache.druid.java.util.common.ISE in project druid by druid-io.

the class OverlordResourceTestClient method getSupervisorHistory.

public List<Object> getSupervisorHistory(String id) {
    try {
        StatusResponseHolder response = httpClient.go(new Request(HttpMethod.GET, new URL(StringUtils.format("%ssupervisor/%s/history", 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());
        }
        List<Object> responseData = jsonMapper.readValue(response.getContent(), new TypeReference<List<Object>>() {
        });
        return responseData;
    } catch (ISE e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : Request(org.apache.druid.java.util.http.client.Request) StatusResponseHolder(org.apache.druid.java.util.http.client.response.StatusResponseHolder) ISE(org.apache.druid.java.util.common.ISE) ArrayList(java.util.ArrayList) List(java.util.List) URL(java.net.URL)

Aggregations

ISE (org.apache.druid.java.util.common.ISE)354 IOException (java.io.IOException)95 ArrayList (java.util.ArrayList)90 Map (java.util.Map)68 List (java.util.List)60 File (java.io.File)48 Interval (org.joda.time.Interval)48 DataSegment (org.apache.druid.timeline.DataSegment)44 HashMap (java.util.HashMap)43 Nullable (javax.annotation.Nullable)43 URL (java.net.URL)36 StatusResponseHolder (org.apache.druid.java.util.http.client.response.StatusResponseHolder)33 Request (org.apache.druid.java.util.http.client.Request)30 ExecutionException (java.util.concurrent.ExecutionException)29 ImmutableMap (com.google.common.collect.ImmutableMap)28 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)28 VisibleForTesting (com.google.common.annotations.VisibleForTesting)27 Collectors (java.util.stream.Collectors)27 IAE (org.apache.druid.java.util.common.IAE)27 ImmutableList (com.google.common.collect.ImmutableList)26