Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Yaliang Wu <[email protected]>
  • Loading branch information
ylwu-amzn committed Jan 18, 2024
1 parent fef5368 commit 40c76c7
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class MLModelController implements ToXContentObject, Writeable {

public static final String MODEL_ID_FIELD = "model_id"; // mandatory
public static final String USER_RATE_LIMITER_CONFIG = "user_rate_limiter_config";
public static final String USER_RATE_LIMITER_CONFIG = "user_rate_limiter";

@Getter
private String modelId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Getter
public class MLCreateModelControllerResponse extends ActionResponse implements ToXContentObject {

public static final String MODEL_ID_FIELD = "model_id";
public static final String CONTROLLER_ID_FIELD = "controller_id";
public static final String STATUS_FIELD = "status";

@Getter
Expand Down Expand Up @@ -50,7 +50,7 @@ public void writeTo(StreamOutput out) throws IOException {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field(MODEL_ID_FIELD, modelId);
builder.field(CONTROLLER_ID_FIELD, modelId);
builder.field(STATUS_FIELD, status);
builder.endObject();
return builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public MLOutput predict(MLInput mlInput) {
try {
return connectorExecutor.executePredict(mlInput);
} catch (RuntimeException e) {
log.error("Failed to call remote model.", e);
log.debug("Failed to call remote model.", e);
throw e;
} catch (Throwable e) {
log.error("Failed to call remote model.", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ private void indexAndCreateModelController(
MLModelController modelController,
ActionListener<MLCreateModelControllerResponse> actionListener
) {
log.info("Indexing the model controller into system index");
mlIndicesHandler.initMLModelControllerIndex(ActionListener.wrap(indexCreated -> {
if (!indexCreated) {
actionListener.onFailure(new RuntimeException("Failed to create model controller index."));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import static org.opensearch.ml.settings.MLCommonsSettings.ML_COMMONS_MONITORING_REQUEST_COUNT;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -298,6 +299,11 @@ public Long getMemEstGPU(String modelId) {
*/
public synchronized boolean isModelDeployed(String modelId) {
MLModelCache modelCache = modelCaches.get(modelId);
if (modelCache != null) {
log.info("ylwudebug1 --------- model cache state: {}", modelCache.getModelState(), Arrays.toString(modelCache.getWorkerNodes()));
} else {
log.info("ylwudebug1 -------- model cache is null");
}
return modelCache != null && modelCache.getModelState() == MLModelState.DEPLOYED;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public String getName() {
public List<Route> routes() {
return ImmutableList
.of(
new Route(RestRequest.Method.POST, String.format(Locale.ROOT, "%s/model_controllers/{%s}", ML_BASE_URI, PARAMETER_MODEL_ID))
new Route(RestRequest.Method.POST, String.format(Locale.ROOT, "%s/controllers/{%s}", ML_BASE_URI, PARAMETER_MODEL_ID))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public List<Route> routes() {
.of(
new Route(
RestRequest.Method.DELETE,
String.format(Locale.ROOT, "%s/model_controllers/{%s}", ML_BASE_URI, PARAMETER_MODEL_ID)
String.format(Locale.ROOT, "%s/controllers/{%s}", ML_BASE_URI, PARAMETER_MODEL_ID)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public String getName() {
public List<Route> routes() {
return ImmutableList
.of(
new Route(RestRequest.Method.GET, String.format(Locale.ROOT, "%s/model_controllers/{%s}", ML_BASE_URI, PARAMETER_MODEL_ID))
new Route(RestRequest.Method.GET, String.format(Locale.ROOT, "%s/controllers/{%s}", ML_BASE_URI, PARAMETER_MODEL_ID))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public String getName() {
public List<Route> routes() {
return ImmutableList
.of(
new Route(RestRequest.Method.PUT, String.format(Locale.ROOT, "%s/model_controllers/{%s}", ML_BASE_URI, PARAMETER_MODEL_ID))
new Route(RestRequest.Method.PUT, String.format(Locale.ROOT, "%s/controllers/{%s}", ML_BASE_URI, PARAMETER_MODEL_ID))
);
}

Expand Down

0 comments on commit 40c76c7

Please sign in to comment.