diff --git a/docs/summary.md b/docs/summary.md index ce6825df52..f796a09c71 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -75,6 +75,7 @@ * [Python packages](workloads/dependencies/python-packages.md) * [System packages](workloads/dependencies/system-packages.md) * [Custom images](workloads/dependencies/images.md) +* [Debugging](workloads/debugging.md) ## Clients diff --git a/docs/workloads/debugging.md b/docs/workloads/debugging.md new file mode 100644 index 0000000000..1d8d485630 --- /dev/null +++ b/docs/workloads/debugging.md @@ -0,0 +1,23 @@ +# Debugging + +You can test and debug your handler implementation and image by running your API container locally. + +The `cortex prepare-debug` command will generate a debugging configuration file named `.debug.json` based on your api spec, and it will print out a corresponding `docker run` command that can be used to run the container locally. + +For example: + +```bash +cortex prepare-debug cortex.yaml iris-classifier + +> docker run -p 9000:8888 \ +> -e "CORTEX_VERSION=master" \ +> -e "CORTEX_API_SPEC=/mnt/project/iris-classifier.debug.json" \ +> -v /home/ubuntu/iris-classifier:/mnt/project \ +> quay.io/cortexlabs/python-handler-cpu:master +``` + +Make a request to the api container: + +```bash +curl localhost:9000 -X POST -H "Content-Type: application/json" -d @sample.json +```