in src/vw-serving/src/vw_serving/vw_model.py [0:0]
def start(self):
"""
Starts the VW C++ process
"""
if self.closed:
raise VWError("Cannot start a closed model")
if self.current_proc is not None:
raise VWError("Cannot start a model with an active current_proc")
# note bufsize=1 will make sure we immediately flush each output
# line so that we can keep scoring the model.
# bufsize=1 means line buffered.
self.current_proc = subprocess.Popen(self.cmd, bufsize=1,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=False)
self.logger.info("Started VW process!")
# Check if process didn't close with some error
if self.test_mode:
try:
self.predict([])
except Exception as e:
self.logger.exception("Unable to load VW model. Please check the arguments.")
raise VWError("Cannot load the model with the provided arguments: %s" % e)