File tree 2 files changed +15
-4
lines changed
archive/src/main/java/org/pytorch/serve/archive/model
server/src/main/java/org/pytorch/serve/wlm
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 11
11
public class ModelConfig {
12
12
private static final Logger logger = LoggerFactory .getLogger (ModelConfig .class );
13
13
14
+ public static final int defaultStartupTimeout = 120 ; // unit: sec
15
+ public static final int defaultResponseTimeout = 120 ; // unit: sec
16
+
14
17
/** the minimum number of workers of a model */
15
18
private int minWorkers ;
16
19
/** the maximum number of workers of a model */
@@ -20,9 +23,9 @@ public class ModelConfig {
20
23
/** the maximum delay in msec of a batch of a model */
21
24
private int maxBatchDelay ;
22
25
/** the timeout in sec of a specific model's response. */
23
- private int responseTimeout = 120 ; // unit: sec
26
+ private int responseTimeout = defaultResponseTimeout ;
24
27
/** the timeout in sec of a specific model's startup. */
25
- private int startupTimeout = 120 ; // unit: sec
28
+ private int startupTimeout = defaultStartupTimeout ;
26
29
/**
27
30
* the device type where the model is loaded. It can be gpu, cpu. The model is loaded on CPU if
28
31
* deviceType: "cpu" is set on a GPU host.
Original file line number Diff line number Diff line change @@ -193,9 +193,17 @@ public void setModelState(JsonObject modelInfo) {
193
193
minWorkers = modelInfo .get (MIN_WORKERS ).getAsInt ();
194
194
maxWorkers = modelInfo .get (MAX_WORKERS ).getAsInt ();
195
195
maxBatchDelay = modelInfo .get (MAX_BATCH_DELAY ).getAsInt ();
196
- responseTimeout = modelInfo .get (RESPONSE_TIMEOUT ).getAsInt ();
197
- startupTimeout = modelInfo .get (STARTUP_TIMEOUT ).getAsInt ();
198
196
batchSize = modelInfo .get (BATCH_SIZE ).getAsInt ();
197
+ responseTimeout =
198
+ modelInfo .has (RESPONSE_TIMEOUT ) && !modelInfo .get (RESPONSE_TIMEOUT ).isJsonNull ()
199
+ ? modelInfo .get (RESPONSE_TIMEOUT ).getAsInt ()
200
+ : modelArchive .getModelConfig ()
201
+ .defaultResponseTimeout ; // default value for responseTimeout
202
+ startupTimeout =
203
+ modelInfo .has (STARTUP_TIMEOUT ) && !modelInfo .get (STARTUP_TIMEOUT ).isJsonNull ()
204
+ ? modelInfo .get (STARTUP_TIMEOUT ).getAsInt ()
205
+ : modelArchive .getModelConfig ()
206
+ .defaultStartupTimeout ; // default value for startupTimeout
199
207
200
208
JsonElement runtime = modelInfo .get (RUNTIME_TYPE );
201
209
String runtime_str = Manifest .RuntimeType .PYTHON .getValue ();
You can’t perform that action at this time.
0 commit comments