Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit 3b853bd

Browse files
Use js_import instead of js_include (#217)
* js_include -> js_import and other changes * Fix typo and add new line to the end * Fix js_content duplicate error. Add encoding for file openings * Update jshlintrc to use esversion 6 * pull ub16 from public ecr
1 parent b28564b commit 3b853bd

File tree

8 files changed

+18
-11
lines changed

8 files changed

+18
-11
lines changed

.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"asi": true
2+
"asi": true,
3+
"esversion": 6
34
}

docker/1.14/Dockerfile.eia

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:16.04
1+
FROM public.ecr.aws/e2s1w5p1/ubuntu:16.04
22
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true
33

44
ARG TFS_SHORT_VERSION=1.14

docker/build_artifacts/sagemaker/multi_model_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
@contextmanager
2323
def lock(path=DEFAULT_LOCK_FILE):
24-
f = open(path, "w")
24+
f = open(path, "w", encoding="utf8")
2525
fd = f.fileno()
2626
fcntl.lockf(fd, fcntl.LOCK_EX)
2727

docker/build_artifacts/sagemaker/nginx.conf.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ http {
1515
include /etc/nginx/mime.types;
1616
default_type application/json;
1717
access_log /dev/stdout combined;
18-
js_include tensorflow-serving.js;
18+
js_import tensorflowServing.js;
1919

2020
upstream tfs_upstream {
2121
%TFS_UPSTREAM%;
@@ -62,3 +62,4 @@ http {
6262
keepalive_timeout 3;
6363
}
6464
}
65+

docker/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(

docker/build_artifacts/sagemaker/serve.py

Lines changed: 5 additions & 5 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 ""
@@ -159,7 +159,7 @@ def _create_tfs_config(self):
159159

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

162-
with open(self._tfs_config_path, "w") as f:
162+
with open(self._tfs_config_path, "w", encoding="utf8") as f:
163163
f.write(config)
164164

165165
def _setup_gunicorn(self):
@@ -258,11 +258,11 @@ def _create_nginx_config(self):
258258
config = pattern.sub(lambda x: template_values[x.group(1)], template)
259259
log.info("nginx config: \n%s\n", config)
260260

261-
with open("/sagemaker/nginx.conf", "w") as f:
261+
with open("/sagemaker/nginx.conf", "w", encoding="utf8") as f:
262262
f.write(config)
263263

264264
def _read_nginx_template(self):
265-
with open("/sagemaker/nginx.conf.template", "r") as f:
265+
with open("/sagemaker/nginx.conf.template", "r", encoding="utf8") as f:
266266
template = f.read()
267267
if not template:
268268
raise ValueError("failed to read nginx.conf.template")

docker/build_artifacts/sagemaker/tensorflow-serving.js renamed to docker/build_artifacts/sagemaker/tensorflowServing.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,8 @@ function csv_request(r) {
232232
builder.push(']}')
233233
tfs_json_request(r, builder.join(''))
234234
}
235+
236+
export default {invocations, ping, ping_without_model, return_error,
237+
tfs_json_request, make_tfs_uri, parse_custom_attributes,
238+
json_request, is_tfs_json, is_json_lines, generic_json_request,
239+
json_lines_request, csv_request};

docker/build_artifacts/sagemaker/tfs_utils.py

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

222222
log.info("batching config: \n%s\n", config)
223-
with open(batching_config_file, "w") as f:
223+
with open(batching_config_file, "w", encoding="utf8") as f:
224224
f.write(config)
225225

226226

0 commit comments

Comments
 (0)