Skip to content

Commit

Permalink
fixed format
Browse files Browse the repository at this point in the history
  • Loading branch information
udaij12 committed Sep 23, 2024
1 parent a32eda0 commit 2d71148
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions frontend/server/src/main/java/org/pytorch/serve/wlm/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,29 +190,35 @@ public JsonObject getModelState(boolean isDefaultVersion) {
}

public void setModelState(JsonObject modelInfo) {
minWorkers = modelInfo.has(MIN_WORKERS) && !modelInfo.get(MIN_WORKERS).isJsonNull()
? modelInfo.get(MIN_WORKERS).getAsInt()
: 1; // default value for minWorkers

maxWorkers = modelInfo.has(MAX_WORKERS) && !modelInfo.get(MAX_WORKERS).isJsonNull()
? modelInfo.get(MAX_WORKERS).getAsInt()
: 5; // default value for maxWorkers

maxBatchDelay = modelInfo.has(MAX_BATCH_DELAY) && !modelInfo.get(MAX_BATCH_DELAY).isJsonNull()
? modelInfo.get(MAX_BATCH_DELAY).getAsInt()
: 100; // default value for maxBatchDelay

responseTimeout = modelInfo.has(RESPONSE_TIMEOUT) && !modelInfo.get(RESPONSE_TIMEOUT).isJsonNull()
? modelInfo.get(RESPONSE_TIMEOUT).getAsInt()
: 120; // default value for responseTimeout

startupTimeout = modelInfo.has(STARTUP_TIMEOUT) && !modelInfo.get(STARTUP_TIMEOUT).isJsonNull()
? modelInfo.get(STARTUP_TIMEOUT).getAsInt()
: 120; // default value for startupTimeout

batchSize = modelInfo.has(BATCH_SIZE) && !modelInfo.get(BATCH_SIZE).isJsonNull()
? modelInfo.get(BATCH_SIZE).getAsInt()
: 1; // default value for batchSize
minWorkers =
modelInfo.has(MIN_WORKERS) && !modelInfo.get(MIN_WORKERS).isJsonNull()
? modelInfo.get(MIN_WORKERS).getAsInt()
: 1; // default value for minWorkers

maxWorkers =
modelInfo.has(MAX_WORKERS) && !modelInfo.get(MAX_WORKERS).isJsonNull()
? modelInfo.get(MAX_WORKERS).getAsInt()
: 5; // default value for maxWorkers

maxBatchDelay =
modelInfo.has(MAX_BATCH_DELAY) && !modelInfo.get(MAX_BATCH_DELAY).isJsonNull()
? modelInfo.get(MAX_BATCH_DELAY).getAsInt()
: 100; // default value for maxBatchDelay

responseTimeout =
modelInfo.has(RESPONSE_TIMEOUT) && !modelInfo.get(RESPONSE_TIMEOUT).isJsonNull()
? modelInfo.get(RESPONSE_TIMEOUT).getAsInt()
: 120; // default value for responseTimeout

startupTimeout =
modelInfo.has(STARTUP_TIMEOUT) && !modelInfo.get(STARTUP_TIMEOUT).isJsonNull()
? modelInfo.get(STARTUP_TIMEOUT).getAsInt()
: 120; // default value for startupTimeout

batchSize =
modelInfo.has(BATCH_SIZE) && !modelInfo.get(BATCH_SIZE).isJsonNull()
? modelInfo.get(BATCH_SIZE).getAsInt()
: 1; // default value for batchSize

JsonElement runtime = modelInfo.get(RUNTIME_TYPE);
String runtime_str = Manifest.RuntimeType.PYTHON.getValue();
Expand Down

0 comments on commit 2d71148

Please sign in to comment.