Skip to content

Commit c04136c

Browse files
committed
port fix in sagemaker_serving_tensorflow_container
Port the [following](aws/sagemaker-tensorflow-serving-container#217) fix Signed-off-by: Venky Natham <[email protected]>
1 parent 2963add commit c04136c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

container/sagemaker-tensorflow-inferentia/build_artifacts/sagemaker/python_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def _handle_load_model_post(self, res, data): # noqa: C901
150150
tfs_config_file = "/sagemaker/tfs-config/{}/model-config.cfg".format(model_name)
151151
log.info("tensorflow serving model config: \n%s\n", tfs_config)
152152
os.makedirs(os.path.dirname(tfs_config_file))
153-
with open(tfs_config_file, "w") as f:
153+
with open(tfs_config_file, "w", encoding="utf8") as f:
154154
f.write(tfs_config)
155155

156156
batching_config_file = "/sagemaker/batching/{}/batching-config.cfg".format(

container/sagemaker-tensorflow-inferentia/build_artifacts/sagemaker/serve.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
logging.basicConfig(level=logging.INFO)
2525
log = logging.getLogger(__name__)
2626

27-
JS_PING = "js_content ping"
28-
JS_INVOCATIONS = "js_content invocations"
27+
JS_PING = "js_content tensorflowServing.ping"
28+
JS_INVOCATIONS = "js_content tensorflowServing.invocations"
2929
GUNICORN_PING = "proxy_pass http://gunicorn_upstream/ping"
3030
GUNICORN_INVOCATIONS = "proxy_pass http://gunicorn_upstream/invocations"
3131
MULTI_MODEL = "s" if os.environ.get("SAGEMAKER_MULTI_MODEL", "False").lower() == "true" else ""
@@ -167,7 +167,7 @@ def _create_tfs_config(self):
167167

168168
log.info("tensorflow serving model config: \n%s\n", config)
169169

170-
with open(self._tfs_config_path, "w") as f:
170+
with open(self._tfs_config_path, "w", encoding="utf8") as f:
171171
f.write(config)
172172

173173
def _setup_gunicorn(self):
@@ -266,7 +266,7 @@ def _create_nginx_config(self):
266266
config = pattern.sub(lambda x: template_values[x.group(1)], template)
267267
log.info("nginx config: \n%s\n", config)
268268

269-
with open("/sagemaker/nginx.conf", "w") as f:
269+
with open("/sagemaker/nginx.conf", "w", encoding="utf8") as f:
270270
f.write(config)
271271

272272
def _read_nginx_template(self):

container/sagemaker-tensorflow-inferentia/build_artifacts/sagemaker/tfs_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def __init__(self, key, env_var, value, defaulted_message):
223223
config += "%s { value: %s }\n" % (batching_parameter.key, batching_parameter.value)
224224

225225
log.info('batching config: \n%s\n', config)
226-
with open(batching_config_file, 'w') as f:
226+
with open(batching_config_file, 'w', encoding="utf8") as f:
227227
f.write(config)
228228

229229

0 commit comments

Comments
 (0)