Skip to content

Add Python 3 support#416

Merged
dcrankshaw merged 48 commits intoucbrise:developfrom
jwirjo:py2py3updated
May 11, 2018
Merged

Add Python 3 support#416
dcrankshaw merged 48 commits intoucbrise:developfrom
jwirjo:py2py3updated

Conversation

@jwirjo
Copy link
Copy Markdown
Contributor

@jwirjo jwirjo commented Feb 21, 2018

Fixes #138. Added Python3 ClipperPy3TestsDockerfile, ran most integration_tests (run_unittests.sh) in python3 with same output as under python2, but 2 recurring errors.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1032/
Test FAILed.

@dcrankshaw
Copy link
Copy Markdown
Contributor

@jwirjo Can you delete all the extra files you added in bin/? That will make this much easier to review.

@dcrankshaw
Copy link
Copy Markdown
Contributor

Sorry meant to say in clipper_admin/build

Copy link
Copy Markdown
Contributor

@dcrankshaw dcrankshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good. I'm going to play around with this on my machine as well, but I added a first round of comments.

c.dump(func)
serialized_prediction_function = s.getvalue()


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this change

base_image="clipper/python-closure-container:{}".format(__version__),
base_image="default",
num_replicas=1):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete extra line

:py:meth:`clipper.ClipperConnection.set_num_replicas`.
"""


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete extra line

lf.write(c.logs(stdout=True, stderr=True))
except TypeError:
with open(log_file, "wb") as lf:
lf.write(c.logs(stdout=True, stderr=True))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a Python 2 vs 3 thing? If so, instead of trying one way and catching an exception, let's explicitly check for sys.version like you do in the python deployer.

Comment thread containers/python/rpc.py
try:
socket.send("", zmq.SNDMORE)
except:
socket.send("".encode('utf-8'), zmq.SNDMORE)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a Python 2 vs 3 thing? If so, instead of trying one way and catching an exception, let's explicitly check for sys.version like you do in the python deployer and then just use the right version. Throwing and catching an exception can be expensive and the code as-is has unclear semantics.

Comment thread containers/python/sum_container.py Outdated
return [str(sum(item)) for item in inputs]

def predict_strings(self, inputs):
print(inputs)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

Comment thread dockerfiles/ClipperPy3TestsDockerfile Outdated
&& git apply ../patches/make_spdlog_compile_linux.patch


ENTRYPOINT ["/clipper/bin/ci_checks.sh"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to modify this entrypoint command to just run the Python 3-compatible tests, not re-run everything

@@ -0,0 +1,13 @@
ARG CODE_VERSION
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dockerfile file name should not end in .txt

Comment thread dockerfiles/Py3RPCDockerfile.txt Outdated
@@ -0,0 +1,20 @@
# This ARG isn't used but prevents warnings in the build script
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dockerfile file name should not end in .txt

#'test_remove_inactive_containers_succeeds',
#'test_stop_models',
#'test_python_closure_deploys_successfully',
'test_register_py_endpoint',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these all commented out?

Comment thread bin/build_docker_images.sh Outdated
create_image query_frontend QueryFrontendDockerfile $public
create_image management_frontend ManagementFrontendDockerfile $public
create_image unittests ClipperTestsDockerfile $private
create_image unittests ClipperPy3TestsDockerfile $private
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the name of the Py3 unittests image to py3tests

@dcrankshaw dcrankshaw changed the title Py2py3updated Add Python 3 support Feb 28, 2018
@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1084/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1085/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1087/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1090/
Test FAILed.

Copy link
Copy Markdown
Contributor

@dcrankshaw dcrankshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super close! I added a comment that should help get the tests passing, and then this will be good to go.

Comment thread .pypirc Outdated
[test]
repository = https://test.pypi.org/legacy/
username = jwirjo
password = clippertest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You definitely don't want to commit this!

Comment thread bin/run_unittests.sh Outdated
run_rpc_container_tests
;;
-i | --integration_tests ) set_test_environment
-i | --integration_tests ) #set_test_environment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert this change


COPY clipper_admin/clipper_admin/python3_container_conda_deps.txt /lib/
RUN conda install -y --file /lib/python3_container_conda_deps.txt
RUN conda install -c anaconda3 cloudpickle=0.5.2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change lines 4-5 to:

RUN conda config --set ssl_verify no \
    && conda install -c anaconda3 cloudpickle=0.5.2 \
    && conda install -y --file /lib/python3_container_conda_deps.txt

This should fix the current test failure (see #426)

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1100/
Test FAILed.

Comment thread bin/run_unittests.sh Outdated
python ../integration-tests/deploy_pyspark_models.py
python ../integration-tests/deploy_pyspark_pipeline_models.py
python ../integration-tests/deploy_pyspark_sparkml_models.py
python ../integration-tests/deploy_pytorch_models.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this test seems to be failing, you can revert it and I'll add it in a separate PR.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1127/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1131/
Test FAILed.

@dcrankshaw
Copy link
Copy Markdown
Contributor

jenkins test this please

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1326/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1328/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1333/
Test FAILed.

@dcrankshaw
Copy link
Copy Markdown
Contributor

jenkins test this please

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1334/
Test FAILed.

@dcrankshaw
Copy link
Copy Markdown
Contributor

@jwirjo @rohsuresh Any progress on this?

@jwirjo jwirjo mentioned this pull request Apr 26, 2018
Closed
@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1419/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1421/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1423/
Test FAILed.

@dcrankshaw
Copy link
Copy Markdown
Contributor

jenkins test this please

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1424/
Test FAILed.

@dcrankshaw
Copy link
Copy Markdown
Contributor

jenkins test this please

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1425/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1426/
Test FAILed.

@AmplabJenkins
Copy link
Copy Markdown

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1427/
Test PASSed.

@AmplabJenkins
Copy link
Copy Markdown

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/1428/
Test PASSed.

@dcrankshaw dcrankshaw merged commit 735815f into ucbrise:develop May 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants