Skip to content

Commit 9174141

Browse files
committed
Add option to run MMS in the foreground
1 parent 2fddb40 commit 9174141

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

docs/configuration.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ User can following parameters to start MMS, those parameters will override defau
2121
* **--model-store** This parameter will override `model_store` property in config.properties file.
2222
* **--models** This parameter will override `load_models' property in config.properties.
2323
* **--log-config** This parameter will override default log4j.properties.
24+
* **--foreground** This parameter will run the model server in foreground. If this option is
25+
disabled, the model server will run in the background.
2426

2527
See [Running the Model Server](server.md) for detail.
2628

mms/arg_parser.py

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ def mms_parser():
4848
parser.add_argument('--log-config',
4949
dest='log_config',
5050
help='Log4j configuration file for model server')
51+
parser.add_argument('--foreground',
52+
help='Run the model server in foreground. If this option is disabled, the model server'
53+
' will run in the background.',
54+
action='store_true')
5155

5256
return parser
5357

mms/model_server.py

+2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ def start():
132132
pid = process.pid
133133
with open(pid_file, "w") as pf:
134134
pf.write(str(pid))
135+
if args.foreground:
136+
process.wait()
135137
except OSError as e:
136138
if e.errno == 2:
137139
print("java not found, please make sure JAVA_HOME is set properly.")

0 commit comments

Comments
 (0)