## Load in the transformation pipeline
mypipeline = PipelineModel.load("/mnt/trainedmodels/pipeline/")
## Load in trained model
mymodel = CrossValidatorModel.load("/mnt/trainedmodels/lr")
Define username, key, and IP address
username = "admin"
ip = "10.0.0.4" #Internal IP
sas_url = "" # SAS Token for your VM's Private Key in Blob
server = serving_outputs.writeStream \.continuousServer()\.trigger(continuous="1 second")\.replyTo("my_api")\.queryName("my_query")\.option("checkpointLocation", "file:///tmp/checkpoints-{}".format(uuid.uuid1()))\.start()
Test the webservice
import requests
data = u'{"id":0,"x1":1,"x2":2.0,"x3":"3"}'
#r = requests.post(data=data, url="http://localhost:8898/my_api") # Locally
r = requests.post(data=data, url="http://102.208.216.32:8902/my_api") # Via the VM IP
print("Response {}".format(r.text))
You may need to run sudo netstat -tulpn to see what port is open if you're running inside Databricks.
Use this command to look for the port that was opened by the server.