Conversation
|
Test FAILed. |
clipper_admin/__init__.py
Outdated
| import sys | ||
| if sys.version_info >= (3, 0): | ||
| sys.stdout.write( | ||
| "Sorry, clipper_admin requires Python 2.x, not Python 3.x\n") |
There was a problem hiding this comment.
"Sorry, clipper_admin requires Python 2.x, but you are running Python 3.x" seems clearer
|
|
||
| Example | ||
| ------- | ||
| Define a feature function ``center()`` and train a model on the featurized input:: |
There was a problem hiding this comment.
Nit: Extra colon after input
There was a problem hiding this comment.
That's an intentional pydoc markup symbol (https://docs.python.org/devguide/documenting.html#source-code)
There was a problem hiding this comment.
Got it, thanks for clarifying!
clipper_admin/clipper_manager.py
Outdated
| self.add_container(model_name, model_version) | ||
|
|
||
| def remove_inactive_containers(self, model_name): | ||
| # TODO: Test this function |
There was a problem hiding this comment.
Yeah I want to add a test for this. Let's get #187 merged before this. Leaving the TODO in for now.
| @@ -201,7 +199,6 @@ | |||
| " 2,\n", | |||
| " os.path.abspath(\"tf_cifar_model\"),\n", | |||
| " \"clipper/tf_cifar_container:latest\",\n", | |||
There was a problem hiding this comment.
Should the cifar and sklearn containers reference version 0.1 as opposed to latest as well?
There was a problem hiding this comment.
I don't think it matters for this tutorial.
clipper_admin/clipper_manager.py
Outdated
| for container in container_ids: | ||
| # returns a string formatted as "<model_name>:<model_version>" | ||
| container_model_name_and_version = self._execute_root( | ||
| "docker inspect --format \"{{ index .Config.Labels \\\"%s\\\"}}\" %s" |
There was a problem hiding this comment.
This fails in the case where no model containers are actively running.
>>> inst.remove_inactive_containers("m1")
Fatal error: local() encountered an error (return code 1) while executing 'docker inspect --format "{{ index .Config.Labels \"ai.clipper.model_container.model_version\"}}" '
================================ Standard error ================================
"docker inspect" requires at least 1 argument(s).
See 'docker inspect --help'.
Usage: docker inspect [OPTIONS] NAME|ID [NAME|ID...]
Return low-level information on Docker objects
================================================================================
Aborting.
There was a problem hiding this comment.
Good catch. Fixed.
| subprocess.call("docker save -o /tmp/{fn}.tar {cn}".format( | ||
| fn=saved_fname, cn=container_name)) | ||
| tar_loc = "/tmp/{fn}.tar".format(fn=saved_fname) | ||
| self._execute_put(tar_loc, tar_loc) |
There was a problem hiding this comment.
tar_loc is now undefined yet is being referenced. Why were these lines removed?
There was a problem hiding this comment.
Oh weird. They were not supposed to be. Adding them back.
| if __name__ == '__main__': | ||
| host = "localhost" | ||
| clipper = cm.Clipper(host, check_for_docker=False) | ||
| clipper = Clipper(host, check_for_docker=False) |
There was a problem hiding this comment.
why don't we check for docker here?
There was a problem hiding this comment.
Because this example doesn't start Clipper, it assumes there is already a Clipper instance running and model connected. We don't check for Docker so that the example works even if you aren't using Docker to run Clipper.
There was a problem hiding this comment.
Got it! The key part is the docker-independent functionality.
jegonzal
left a comment
There was a problem hiding this comment.
@Corey-Zumar did an excellent job reviewing. I would approve pending his comments.
|
Test FAILed. |
|
Test FAILed. |
|
Test FAILed. |
|
Test PASSed. |
Corey-Zumar
left a comment
There was a problem hiding this comment.
LGTM. Let me know if I should hold off until #187 is merged. If not, we should create an issue reminding us to write a test for remove_inactive_containers.
|
Test PASSed. |
|
@Corey-Zumar this went through a big round of changes, so you'd better review again |
clipper_admin/clipper_manager.py
Outdated
| container_name, | ||
| labels, | ||
| input_type, | ||
| labels=[DEFAULT_LABEL], |
There was a problem hiding this comment.
What's the purpose of having all models get a "default" label? Can this be defaulted to []?
| # Get all Docker containers tagged as model containers | ||
| num_containers_removed = 0 | ||
| with hide("output", "warnings", "running"): | ||
| containers = self._execute_root( |
There was a problem hiding this comment.
What is the reasoning for dropping into shell commands over using libraries? e.g. https://docker-py.readthedocs.io/en/stable/containers.html#docker.models.containers.ContainerCollection.list
There was a problem hiding this comment.
Simplicity and wanting to use the same commands locally and remotely. As we refactor clipper_manager.py we should definitely look into the Python SDK.
Corey-Zumar
left a comment
There was a problem hiding this comment.
Just requesting that we rename an integration test file + a nit comment. Looks good in general
bin/run_unittests.sh
Outdated
| echo -e "\nRunning integration tests\n\n" | ||
| cd $DIR | ||
| python ../integration-tests/clipper_manager_tests.py | ||
| python ../integration-tests/light_load_all_functionality.py 2 3 |
There was a problem hiding this comment.
Now that we have multiple integration tests, let's rename light_load_all_functionality to something more descriptive.
| std::string test_json_string = | ||
| "{\"uid\": 23, \"input\": \"hello world. This is a test string with " | ||
| "{\"input\": \"hello world. This is a test string with " | ||
| "punctionation!@#$Y#;}#\"}"; |
There was a problem hiding this comment.
Very nit: Typo in "punctuation".
There was a problem hiding this comment.
This isn't a real word anyway. Leaving as is.
| cur_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| sys.path.insert(0, os.path.abspath('%s/../' % cur_dir)) | ||
| import clipper_manager | ||
| from clipper_admin import clipper_manager |
There was a problem hiding this comment.
AFAICT clipper_manager is only used to access the Clipper class so we could directly import Clipper here
There was a problem hiding this comment.
Ahh yeah good catch. This is a holdover from before the package structure existed.
| sys.path.insert(0, os.path.abspath('%s/../clipper_admin/' % cur_dir)) | ||
| import clipper_manager as cm | ||
| sys.path.insert(0, os.path.abspath('%s/../' % cur_dir)) | ||
| from clipper_admin import clipper_manager as cm |
There was a problem hiding this comment.
Ditto about importing Clipper directly
|
@Corey-Zumar @feynmanliang addressed your comments. @Corey-Zumar please merge once the tests pass. |
|
Test FAILed. |
|
Test FAILed. |
|
jenkins test this please |
|
Test FAILed. |
|
Test FAILed. |
|
Test FAILed. |
|
Test PASSed. |
This PR makes several backwards-compatible usability fixes to make Clipper less confusing. In particular:
remove_inactive_containers()to clean up inactive containers (@rmdort)Clipperclass in theclipper_adminmodule, so now users can import Clipper withfrom clipper_admin import Clipperinspect_selection_policyprivate so it doesn't show up in API documentationclipper_adminfor python 3 and exits with an error message if Python 3 is detected.