Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3 support #416

Merged
merged 48 commits into from May 11, 2018
Merged

Add Python 3 support #416

merged 48 commits into from May 11, 2018

Conversation

jwirjo
Copy link
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

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
Contributor

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

@dcrankshaw
Copy link
Contributor

Sorry meant to say in clipper_admin/build

Copy link
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.

@@ -42,6 +42,7 @@ def save_python_function(name, func):
c.dump(func)
serialized_prediction_function = s.getvalue()


Copy link
Contributor

Choose a reason for hiding this comment

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

Revert this change

num_replicas=1):

Copy link
Contributor

Choose a reason for hiding this comment

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

Delete extra line

@@ -72,6 +74,7 @@ def create_endpoint(
:py:meth:`clipper.ClipperConnection.set_num_replicas`.
"""


Copy link
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
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.

try:
socket.send("", zmq.SNDMORE)
except:
socket.send("".encode('utf-8'), zmq.SNDMORE)
Copy link
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.

@@ -22,6 +22,7 @@ def predict_bytes(self, inputs):
return [str(sum(item)) for item in inputs]

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

Choose a reason for hiding this comment

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

revert

&& git apply ../patches/make_spdlog_compile_linux.patch


ENTRYPOINT ["/clipper/bin/ci_checks.sh"]
Copy link
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
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

@@ -0,0 +1,20 @@
# This ARG isn't used but prevents warnings in the build script
Copy link
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_set_num_replicas_for_deployed_model_succeeds',
#'test_remove_inactive_containers_succeeds',
#'test_stop_models',
#'test_python_closure_deploys_successfully',
'test_register_py_endpoint',
Copy link
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?

@@ -245,16 +245,20 @@ build_images () {
create_image query_frontend QueryFrontendDockerfile $public
create_image management_frontend ManagementFrontendDockerfile $public
create_image unittests ClipperTestsDockerfile $private
create_image unittests ClipperPy3TestsDockerfile $private
Copy link
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

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

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

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

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
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.

.pypirc Outdated
[test]
repository = https://test.pypi.org/legacy/
username = jwirjo
password = clippertest
Copy link
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!

@@ -197,7 +198,7 @@ case $args in
-r | --rpc-container ) set_test_environment
run_rpc_container_tests
;;
-i | --integration_tests ) set_test_environment
-i | --integration_tests ) #set_test_environment
Copy link
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
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

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.

@@ -140,6 +140,7 @@ function run_integration_tests {
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
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

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

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
Contributor

jenkins test this please

@AmplabJenkins
Copy link

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

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

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
Contributor

jenkins test this please

@AmplabJenkins
Copy link

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
Contributor

@jwirjo @rohsuresh Any progress on this?

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

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

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

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
Contributor

jenkins test this please

@AmplabJenkins
Copy link

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
Contributor

jenkins test this please

@AmplabJenkins
Copy link

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

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

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

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.

None yet

4 participants