Skip to content

Commit e0cecc0

Browse files
committed
Start the h2o and pmml server if possible
1 parent a51727b commit e0cecc0

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ tensorflow>=1.0.0
88
scikit-learn
99
xgboost
1010
mxnet
11-
h2o
11+
h2o==3.18.0.8
1212
onnx
1313
#git+https://github.com/openscoring/openscoring-python.git

simple_tensorflow_serving/h2o_inference_service.py

+10
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
from __future__ import division
33
from __future__ import print_function
44

5+
import os
56
import logging
67
import time
78
import json
9+
import subprocess
810

911
from .abstract_inference_service import AbstractInferenceService
1012
from . import filesystem_util
@@ -29,6 +31,14 @@ def __init__(self, model_name, model_base_path):
2931
"""
3032
super(H2oInferenceService, self).__init__()
3133

34+
# Start the h2o server
35+
if os.path.isfile("/tmp/h2o.jar"):
36+
logging.info("Run to run command 'java -jar /tmp/h2o.jar'")
37+
subprocess.Popen(["java", "-jar", "/tmp/h2o.jar"])
38+
39+
logging.info("Sleep 10s to wait for h2o server")
40+
time.sleep(10)
41+
3242
local_model_base_path = filesystem_util.download_hdfs_moels(
3343
model_base_path)
3444

simple_tensorflow_serving/pmml_inference_service.py

+10
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
from __future__ import division
33
from __future__ import print_function
44

5+
import os
56
import logging
67
import time
8+
import subprocess
79

810
from .abstract_inference_service import AbstractInferenceService
911
from . import filesystem_util
@@ -29,6 +31,14 @@ def __init__(self, model_name, model_base_path):
2931

3032
super(PmmlInferenceService, self).__init__()
3133

34+
# Start the pmml server
35+
if os.path.isfile("/tmp/openscoring-server-executable-1.4-SNAPSHOT.jar"):
36+
logging.info("Run to run command 'java -jar /tmp/openscoring-server-executable-1.4-SNAPSHOT.jar'")
37+
subprocess.Popen(["java", "-jar", "/tmp/openscoring-server-executable-1.4-SNAPSHOT.jar"])
38+
39+
logging.info("Sleep 10s to wait for pmml server")
40+
time.sleep(10)
41+
3242
local_model_base_path = filesystem_util.download_hdfs_moels(
3343
model_base_path)
3444

third_party/h2o/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# H2O
2+
3+
## Usage
4+
5+
Download with `wget http://h2o-release.s3.amazonaws.com/h2o/rel-wolpert/8/h2o-3.18.0.8.zip`.

0 commit comments

Comments
 (0)