Example usage for com.amazonaws.services.machinelearning.model RealtimeEndpointStatus READY

List of usage examples for com.amazonaws.services.machinelearning.model RealtimeEndpointStatus READY

Introduction

In this page you can find the example usage for com.amazonaws.services.machinelearning.model RealtimeEndpointStatus READY.

Prototype

RealtimeEndpointStatus READY

To view the source code for com.amazonaws.services.machinelearning.model RealtimeEndpointStatus READY.

Click Source Link

Usage

From source file:AndroidRealtimePrediction.java

License:Open Source License

/**
 * Calls GetMLModel. /*from   ww w .j ava2s  . c  o  m*/
 * Checks if the model is completed and real-time endpoint is ready for predict calls
 */
private void getRealtimeEndpoint() {
    GetMLModelRequest request = new GetMLModelRequest();
    request.setMLModelId(mlModelId);
    GetMLModelResult result = client.getMLModel(request);

    if (!result.getStatus().equals(EntityStatus.COMPLETED.toString())) {
        throw new IllegalStateException("ML model " + mlModelId + " needs to be completed.");
    }
    if (!result.getEndpointInfo().getEndpointStatus().equals(RealtimeEndpointStatus.READY.toString())) {
        throw new IllegalStateException(
                "ML model " + mlModelId + "'s real-time endpoint is not yet ready or needs to be created.");
    }

    this.endpoint = result.getEndpointInfo().getEndpointUrl();
}