Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated configuration.md for missing config properties #337

Merged
merged 13 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,19 @@ Most of the following properties are designed for performance tuning. Adjusting
* `decode_input_request`: Configuration to let backend workers to decode requests, when the content type is known.
If this is set to "true", backend workers do "Bytearray to JSON object" conversion when the content type is "application/json" and
the backend workers convert "Bytearray to utf-8 string" when the Content-Type of the request is set to "text*". Default: true
* `model_store` : Path of model store directory.
* `model_server_home` : Torchserve home directory.
* `max_request_size` : The maximum allowable request size that the Torchserve accepts, in bytes. Default: 6553500
* `max_response_size` : The maximum allowable response size that the Torchserve sends, in bytes. Default: 6553500

---
**NOTE**

All the above config properties can be set using environment variable as follows.
- set `enable_envvars_config` to true in config.properties
- export environment variable for property as`TS_<PROPERTY_NAME>`.

eg: to set inference_address property run cmd
`export TS_INFERENCE_ADDRESS="http://127.0.0.1:8082"`.

---
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class FSSnapshotSerializer implements SnapshotSerializer {

private Logger logger = LoggerFactory.getLogger(FSSnapshotSerializer.class);
private ConfigManager configManager = ConfigManager.getInstance();
private static final String TS_MODEL_SNAPSHOT = "model_snapshot";
private static final String MODEL_SNAPSHOT = "model_snapshot";
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();

@Override
Expand All @@ -43,7 +43,7 @@ public void saveSnapshot(Snapshot snapshot) throws IOException {
}

String snapshotJson = GSON.toJson(snapshot, Snapshot.class);
prop.put(TS_MODEL_SNAPSHOT, snapshotJson);
prop.put(MODEL_SNAPSHOT, snapshotJson);
try (OutputStream os = Files.newOutputStream(snapshotFile.toPath())) {
OutputStreamWriter osWriter = new OutputStreamWriter(os, StandardCharsets.UTF_8);
prop.store(osWriter, "Saving snapshot");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ public final class ConfigManager {
private static final String TS_MAX_REQUEST_SIZE = "max_request_size";
private static final String TS_MAX_RESPONSE_SIZE = "max_response_size";
private static final String TS_DEFAULT_SERVICE_HANDLER = "default_service_handler";
private static final String MODEL_SERVER_HOME = "model_server_home";
private static final String TS_MODEL_SERVER_HOME = "model_server_home";
private static final String TS_MODEL_STORE = "model_store";
private static final String TS_SNAPSHOT_STORE = "snapshot_store";
private static final String TS_MODEL_SNAPSHOT = "model_snapshot";

// Configuration which are not documented or enabled through environment variables
private static final String USE_NATIVE_IO = "use_native_io";
private static final String IO_RATIO = "io_ratio";
private static final String METRIC_TIME_INTERVAL = "metric_time_interval";
private static final String ENABLE_ENVVARS_CONFIG = "enable_envvars_config";
private static final String MODEL_SNAPSHOT = "model_snapshot";
private static final String VERSION = "version";

// Variables which are local
Expand Down Expand Up @@ -317,11 +317,11 @@ public int getMetricTimeInterval() {
}

public String getModelServerHome() {
String tsHome = System.getenv("MODEL_SERVER_HOME");
String tsHome = System.getenv("TS_MODEL_SERVER_HOME");
if (tsHome == null) {
tsHome = System.getProperty(MODEL_SERVER_HOME);
tsHome = System.getProperty(TS_MODEL_SERVER_HOME);
if (tsHome == null) {
tsHome = getProperty(MODEL_SERVER_HOME, null);
tsHome = getProperty(TS_MODEL_SERVER_HOME, null);
if (tsHome == null) {
tsHome = getCanonicalPath(findTsHome());
return tsHome;
Expand Down Expand Up @@ -350,7 +350,7 @@ public String getSnapshotStore() {
}

public String getModelSnapshot() {
return prop.getProperty(TS_MODEL_SNAPSHOT, null);
return prop.getProperty(MODEL_SNAPSHOT, null);
}

public String getLoadModels() {
Expand Down