From ca1c29a3a1c3a63f22b646fbd03e89d7610ddacb Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Fri, 21 Jun 2019 18:40:13 -0700 Subject: [PATCH 01/30] Rename app to deployment --- .github/ISSUE_TEMPLATE/bug-report.md | 4 +- README.md | 4 +- cli/cmd/delete.go | 4 +- cli/cmd/deploy.go | 4 +- cli/cmd/errors.go | 4 +- cli/cmd/root.go | 2 +- docs/applications/advanced/python-packages.md | 4 +- docs/applications/advanced/templates.md | 2 +- docs/applications/resources/aggregators.md | 2 +- docs/applications/resources/apis.md | 2 +- docs/applications/resources/app.md | 17 --------- docs/applications/resources/data-types.md | 2 +- docs/applications/resources/deployment.md | 17 +++++++++ docs/applications/resources/estimators.md | 2 +- docs/applications/resources/overview.md | 6 +-- docs/applications/resources/transformers.md | 2 +- docs/development.md | 2 +- docs/operator/cli.md | 38 +++++++++---------- docs/operator/install.md | 2 +- docs/summary.md | 2 +- docs/tutorial.md | 10 ++--- examples/external-model/cortex.yaml | 2 +- examples/fraud/cortex.yaml | 2 +- examples/insurance/cortex.yaml | 2 +- examples/iris/cortex.yaml | 2 +- examples/mnist/cortex.yaml | 2 +- examples/movie-ratings/cortex.yaml | 2 +- examples/poker/cortex.yaml | 2 +- examples/reviews/cortex.yaml | 2 +- examples/wine/cortex.yaml | 2 +- pkg/operator/api/resource/type.go | 4 +- pkg/operator/api/userconfig/errors.go | 2 +- pkg/operator/endpoints/errors.go | 2 +- pkg/operator/workloads/errors.go | 4 +- pkg/workloads/tf_api/api.py | 4 +- 35 files changed, 83 insertions(+), 83 deletions(-) delete mode 100644 docs/applications/resources/app.md create mode 100644 docs/applications/resources/deployment.md diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index ba99ba9155..0d2a3b627a 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -11,9 +11,9 @@ assignees: '' [Description of the bug] -### Application Configuration +### Configuration -[If applicable, any relevant resource configuration or the name of the example application] +[If applicable, any relevant resource configuration or the name of the example] ### To Reproduce diff --git a/README.md b/README.md index 260693e73f..72d249a8ed 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Cortex is actively maintained by Cortex Labs. We're a venture-backed team of inf ## How it works -1. **Define your app:** define your app using Python, TensorFlow, and PySpark. +1. **Define your app:** define your application using Python, TensorFlow, and PySpark. 2. **`$ cortex deploy`:** deploy end-to-end machine learning pipelines to AWS with one command. @@ -98,7 +98,7 @@ Ready! https://abc.amazonaws.com/my-api ## Key features -- **Machine learning pipelines as code:** Cortex applications are defined using a simple declarative syntax that enables flexibility and reusability. +- **Machine learning pipelines as code:** Cortex deployments are defined using a simple declarative syntax that enables flexibility and reusability. - **End-to-end machine learning workflow:** Cortex spans the machine learning workflow from feature management to model training to prediction serving. diff --git a/cli/cmd/delete.go b/cli/cmd/delete.go index 13513654d3..80c40ff7c7 100644 --- a/cli/cmd/delete.go +++ b/cli/cmd/delete.go @@ -30,12 +30,12 @@ import ( var flagKeepCache bool func init() { - deleteCmd.PersistentFlags().BoolVarP(&flagKeepCache, "keep-cache", "c", false, "keep cached data for the app") + deleteCmd.PersistentFlags().BoolVarP(&flagKeepCache, "keep-cache", "c", false, "keep cached data for the deployment") addEnvFlag(deleteCmd) } var deleteCmd = &cobra.Command{ - Use: "delete [APP_NAME]", + Use: "delete [DEPLOYMENT_NAME]", Short: "delete a deployment", Long: "Delete a deployment.", Args: cobra.MaximumNArgs(1), diff --git a/cli/cmd/deploy.go b/cli/cmd/deploy.go index 89507f167b..53351dcb99 100644 --- a/cli/cmd/deploy.go +++ b/cli/cmd/deploy.go @@ -37,8 +37,8 @@ func init() { var deployCmd = &cobra.Command{ Use: "deploy", - Short: "deploy an application", - Long: "Deploy an application.", + Short: "create or update a deployment", + Long: "Create or update a deployment.", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { deploy(flagDeployForce, false) diff --git a/cli/cmd/errors.go b/cli/cmd/errors.go index ae50c4b823..e84c0b5ec2 100644 --- a/cli/cmd/errors.go +++ b/cli/cmd/errors.go @@ -95,7 +95,7 @@ func (e Error) Error() string { func ErrorCliAlreadyInAppDir(dirPath string) error { return Error{ Kind: ErrCliAlreadyInAppDir, - message: fmt.Sprintf("your current working directory is already in a cortex app directory (%s)", dirPath), + message: fmt.Sprintf("your current working directory is already in a cortex directory (%s)", dirPath), } } @@ -123,6 +123,6 @@ func ErrorFailedToConnect(urlStr string) error { func ErrorCliNotInAppDir() error { return Error{ Kind: ErrCliNotInAppDir, - message: "your current working directory is not in or under a cortex app directory (identified via a top-level cortex.yaml file)", + message: "your current working directory is not in or under a cortex directory (identified via a top-level cortex.yaml file)", } } diff --git a/cli/cmd/root.go b/cli/cmd/root.go index 50fb9a8988..0d3d9c2d2f 100644 --- a/cli/cmd/root.go +++ b/cli/cmd/root.go @@ -96,7 +96,7 @@ func addWatchFlag(cmd *cobra.Command) { } func addAppNameFlag(cmd *cobra.Command) { - cmd.PersistentFlags().StringVarP(&flagAppName, "app", "a", "", "app name") + cmd.PersistentFlags().StringVarP(&flagAppName, "deployment", "d", "", "deployment name") } func addVerboseFlag(cmd *cobra.Command) { diff --git a/docs/applications/advanced/python-packages.md b/docs/applications/advanced/python-packages.md index ed1312527c..b5a6d336be 100644 --- a/docs/applications/advanced/python-packages.md +++ b/docs/applications/advanced/python-packages.md @@ -4,7 +4,7 @@ Cortex allows you to install additional Python packages that can be made availab ## PyPI Packages -Cortex looks for a `requirements.txt` file in the top level directory of the app (in the same level as `cortex.yaml`). All packages listed in `requirements.txt` will be made available to aggregators, transformers, and estimators. +Cortex looks for a `requirements.txt` file in the top level cortex directory (in the same level as `cortex.yaml`). All packages listed in `requirements.txt` will be made available to aggregators, transformers, and estimators. ```text ./iris/ @@ -19,7 +19,7 @@ Cortex looks for a `requirements.txt` file in the top level directory of the app Cortex looks for your Python packages in the directory `./packages/`. The package must have a `setup.py` in the root of the package directory with the name set to your package name. Cortex will run `pip3 wheel -w wheelhouse ./packages/` to construct wheels for the Python Project. -Cortex App Directory +Cortex Directory ```text ./iris/ diff --git a/docs/applications/advanced/templates.md b/docs/applications/advanced/templates.md index 25a0c5a544..ccfd82a689 100644 --- a/docs/applications/advanced/templates.md +++ b/docs/applications/advanced/templates.md @@ -1,6 +1,6 @@ # Templates -Templates allow you to reuse resource configuration within your application. +Templates allow you to reuse resource configuration accross your configuration files. ## Config diff --git a/docs/applications/resources/aggregators.md b/docs/applications/resources/aggregators.md index 38cfe6b26f..62c16d7bfa 100644 --- a/docs/applications/resources/aggregators.md +++ b/docs/applications/resources/aggregators.md @@ -9,7 +9,7 @@ Custom aggregators can be implemented in Python or PySpark. See the [implementat ```yaml - kind: aggregator name: # aggregator name (required) - path: # path to the implementation file, relative to the application root (default: implementations/aggregators/.py) + path: # path to the implementation file, relative to the cortex root (default: implementations/aggregators/.py) output_type: # the output type of the aggregator (required) input: # the input type of the aggregator (required) ``` diff --git a/docs/applications/resources/apis.md b/docs/applications/resources/apis.md index ee0f9dfe8c..e55d89d18a 100644 --- a/docs/applications/resources/apis.md +++ b/docs/applications/resources/apis.md @@ -30,7 +30,7 @@ Serve models at scale and use them to build smarter applications. ## Integration -APIs can be integrated into other applications or services via their JSON endpoints. The endpoint for any API follows the following format: {apis_endpoint}/{app_name}/{api_name}. +APIs can be integrated into other applications or services via their JSON endpoints. The endpoint for any API follows the following format: {apis_endpoint}/{deployment_name}/{api_name}. The fields in the request payload for a particular API should match the raw columns that were used to train the model that it is serving. Cortex automatically applies the same transformers that were used at training time when responding to prediction requests. diff --git a/docs/applications/resources/app.md b/docs/applications/resources/app.md deleted file mode 100644 index 0c12782c12..0000000000 --- a/docs/applications/resources/app.md +++ /dev/null @@ -1,17 +0,0 @@ -# Application - -The app resource is used to group a set of resources into an application that can be deployed as a singular unit. It must be defined in every Cortex application directory in a top-level `cortex.yaml` file. - -## Config - -```yaml -- kind: app - name: # app name (required) -``` - -## Example - -```yaml -- kind: app - name: my_app -``` diff --git a/docs/applications/resources/data-types.md b/docs/applications/resources/data-types.md index f124e914bd..428cfa4e04 100644 --- a/docs/applications/resources/data-types.md +++ b/docs/applications/resources/data-types.md @@ -1,6 +1,6 @@ # Data Types -Data types are used in configuration files to help validate data and ensure your Cortex application is functioning as expected. +Data types are used in configuration files to help validate data and ensure your Cortex deployment is functioning as expected. ## Raw Column Types diff --git a/docs/applications/resources/deployment.md b/docs/applications/resources/deployment.md new file mode 100644 index 0000000000..8aae97e242 --- /dev/null +++ b/docs/applications/resources/deployment.md @@ -0,0 +1,17 @@ +# Deployment + +The deployment resource is used to group a set of resources that can be deployed as a singular unit. It must be defined in every Cortex directory in a top-level `cortex.yaml` file. + +## Config + +```yaml +- kind: deployment + name: # deployment name (required) +``` + +## Example + +```yaml +- kind: deployment + name: my_deployment +``` diff --git a/docs/applications/resources/estimators.md b/docs/applications/resources/estimators.md index 4cb02092a0..c9874d1103 100644 --- a/docs/applications/resources/estimators.md +++ b/docs/applications/resources/estimators.md @@ -9,7 +9,7 @@ Custom estimators can be implemented in Python or PySpark. See the [implementati ```yaml - kind: estimator name: # estimator name (required) - path: # path to the implementation file, relative to the application root (default: implementations/estimators/.py) + path: # path to the implementation file, relative to the cortex root (default: implementations/estimators/.py) target_column: # The type of column that can be used as a target (ambiguous types like INT_COLUMN|FLOAT_COLUMN are supported) (required) input: # the input type of the estimator (required) training_input: # the input type of the training input to the estimator (optional) diff --git a/docs/applications/resources/overview.md b/docs/applications/resources/overview.md index 855c43a536..bf6d51d710 100644 --- a/docs/applications/resources/overview.md +++ b/docs/applications/resources/overview.md @@ -1,8 +1,8 @@ # Overview -Cortex applications consist of declarative resource configuration written in YAML as well as Python code to implement aggregators, transformers, and models. Each resource has a `kind`: +Cortex deployments consist of declarative resource configuration written in YAML as well as Python code to implement aggregators, transformers, and models. Each resource has a `kind`: -* [app](app.md) +* [deployment](deployment.md) * [environment](environments.md) * [raw_column](raw-columns.md) * [aggregator](aggregators.md) @@ -16,7 +16,7 @@ Cortex applications consist of declarative resource configuration written in YAM Resources can reference other resources from within their configuration (e.g. when defining input values) by prefixing the other resource's name with an `@` symbol. For example, a model may specify `input: @column1`, which denotes that a resource named "column1" is an input to this model. -With the exception of the `app` kind (which must be defined in a top-level `cortex.yaml` file), resources may be defined in any YAML file within your Cortex application folder or any subdirectories. +With the exception of the `deployment` kind (which must be defined in a top-level `cortex.yaml` file), resources may be defined in any YAML file within your Cortex folder or any subdirectories. The `cortex deploy` command will validate all resource configuration and attempt to create the requested state on the cluster. diff --git a/docs/applications/resources/transformers.md b/docs/applications/resources/transformers.md index 3ba071b9da..7f3687e071 100644 --- a/docs/applications/resources/transformers.md +++ b/docs/applications/resources/transformers.md @@ -9,7 +9,7 @@ Custom transformers can be implemented in Python or PySpark. See the [implementa ```yaml - kind: transformer name: # transformer name (required) - path: # path to the implementation file, relative to the application root (default: implementations/transformers/.py) + path: # path to the implementation file, relative to the cortex root (default: implementations/transformers/.py) output_type: # The type of column that will be generated by this transformer (required) input: # the input type of the transformer (required) ``` diff --git a/docs/development.md b/docs/development.md index 35e8025397..c9d0d43e83 100644 --- a/docs/development.md +++ b/docs/development.md @@ -138,7 +138,7 @@ path/to/cortex/bin/cortex configure ### Deployment -Run an example application: +Deploy an example: ```bash cd examples/iris diff --git a/docs/operator/cli.md b/docs/operator/cli.md index 1d5b64d846..1acc6ba29b 100644 --- a/docs/operator/cli.md +++ b/docs/operator/cli.md @@ -3,7 +3,7 @@ ## deploy ``` -Deploy an application. +Create or update a deployment. Usage: cortex deploy [flags] @@ -14,7 +14,7 @@ Flags: -h, --help help for deploy ``` -The `deploy` command sends all application configuration and code to the operator. If all validations pass, the operator will attempt to create the desired state on the cluster. +The `deploy` command sends all configuration and code to the operator. If all validations pass, the operator will attempt to create the desired state on the cluster. ## refresh @@ -41,10 +41,10 @@ Usage: cortex predict API_NAME SAMPLES_FILE [flags] Flags: - -a, --app string app name - -e, --env string environment (default "dev") - -h, --help help for predict - -j, --json print the raw json response + -d, --deployment string deployment name + -e, --env string environment (default "dev") + -h, --help help for predict + -j, --json print the raw json response ``` The `predict` command converts samples from a JSON file into prediction requests and outputs the response. This command is useful for quickly testing model output. @@ -52,18 +52,18 @@ The `predict` command converts samples from a JSON file into prediction requests ## delete ``` -Delete an application. +Delete a deployment. Usage: - cortex delete [APP_NAME] [flags] + cortex delete [DEPLOYMENT_NAME] [flags] Flags: -e, --env string environment (default "dev") -h, --help help for delete - -c, --keep-cache keep cached data for the app + -c, --keep-cache keep cached data for the deployment ``` -The `delete` command deletes an application's resources from the cluster. +The `delete` command deletes an deployment's resources from the cluster. ## get @@ -82,11 +82,11 @@ Resource Types: api Flags: - -a, --app string app name - -e, --env string environment (default "dev") - -h, --help help for get - -s, --summary show summarized output - -w, --watch re-run the command every 2 seconds + -d, --deployment string deployment name + -e, --env string environment (default "dev") + -h, --help help for get + -s, --summary show summarized output + -w, --watch re-run the command every 2 seconds ``` The `get` command outputs the current state of all resources on the cluster. Specifying a resource name provides a more detailed view of the configuration and state of that particular resource. Using the `-s` or `--summary` flag will show a summarized view of all resource statuses. @@ -108,10 +108,10 @@ Resource Types: api Flags: - -a, --app string app name - -e, --env string environment (default "dev") - -h, --help help for logs - -v, --verbose show verbose output + -d, --deployment string deployment name + -e, --env string environment (default "dev") + -h, --help help for logs + -v, --verbose show verbose output ``` The `logs` command streams logs from the workload corresponding to the specified resource. For example, `cortex logs models dnn` will get the Cortex logs from the most recent training workload for `dnn`. Using the `-v` or `--verbose` flag will show all of the logs for the workload (not just Cortex's logs). diff --git a/docs/operator/install.md b/docs/operator/install.md index a8cc12de9d..7d8531afa7 100644 --- a/docs/operator/install.md +++ b/docs/operator/install.md @@ -60,7 +60,7 @@ The CLI runs on developer machines (e.g. your laptop) and communicates with the cortex configure ``` -## Deploy an application +## Create a deployment diff --git a/docs/summary.md b/docs/summary.md index 7d0da682f3..38deecead6 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -13,7 +13,7 @@ ### Resources - * [Application](applications/resources/app.md) + * [Application](applications/resources/deployment.md) * [Environments](applications/resources/environments.md) * [Raw Columns](applications/resources/raw-columns.md) * [Aggregators](applications/resources/aggregators.md) diff --git a/docs/tutorial.md b/docs/tutorial.md index 0efb14de15..906f75deeb 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -18,19 +18,19 @@ Let's build and deploy a classifier using the famous [iris data set](https://arc Our goal is to build a web API that returns the type of iris given its measurements. -#### Initialize the application +#### Initialize the deployment ```bash mkdir iris && cd iris touch cortex.yaml irises.json ``` -Cortex requires an `cortex.yaml` file which defines an `app` resource. Other resources may be defined in arbitrarily named YAML files in the the directory which contains `cortex.yaml` or any subdirectories. For this example, we will define all of our resources in `cortex.yaml`. +Cortex requires an `cortex.yaml` file which defines a `deployment` resource. Other resources may be defined in arbitrarily named YAML files in the the directory which contains `cortex.yaml` or any subdirectories. For this example, we will define all of our resources in `cortex.yaml`. Add to `cortex.yaml`: ```yaml -- kind: app +- kind: deployment name: iris ``` @@ -90,7 +90,7 @@ Add to `cortex.yaml`: replicas: 2 ``` -## Deploy the application +## Create the deployment ``` $ cortex deploy @@ -147,7 +147,7 @@ $ curl -k \ ## Cleanup -Delete the iris application: +Delete the iris deployment: ``` $ cortex delete iris diff --git a/examples/external-model/cortex.yaml b/examples/external-model/cortex.yaml index 57ddaa01f8..50d96fdc27 100644 --- a/examples/external-model/cortex.yaml +++ b/examples/external-model/cortex.yaml @@ -1,4 +1,4 @@ -- kind: app +- kind: deployment name: external-model - kind: api diff --git a/examples/fraud/cortex.yaml b/examples/fraud/cortex.yaml index 01c245fa53..8c2325bf3c 100644 --- a/examples/fraud/cortex.yaml +++ b/examples/fraud/cortex.yaml @@ -1,2 +1,2 @@ -- kind: app +- kind: deployment name: fraud diff --git a/examples/insurance/cortex.yaml b/examples/insurance/cortex.yaml index 1ae1e70a8b..801579a00c 100644 --- a/examples/insurance/cortex.yaml +++ b/examples/insurance/cortex.yaml @@ -1,2 +1,2 @@ -- kind: app +- kind: deployment name: insurance diff --git a/examples/iris/cortex.yaml b/examples/iris/cortex.yaml index 34ff5d2fad..b906d34a64 100644 --- a/examples/iris/cortex.yaml +++ b/examples/iris/cortex.yaml @@ -1,4 +1,4 @@ -- kind: app +- kind: deployment name: iris - kind: environment diff --git a/examples/mnist/cortex.yaml b/examples/mnist/cortex.yaml index a7d2a42bf9..3bbb3c6ff3 100644 --- a/examples/mnist/cortex.yaml +++ b/examples/mnist/cortex.yaml @@ -1,2 +1,2 @@ -- kind: app +- kind: deployment name: mnist diff --git a/examples/movie-ratings/cortex.yaml b/examples/movie-ratings/cortex.yaml index e9dda0b34b..4898b600b0 100644 --- a/examples/movie-ratings/cortex.yaml +++ b/examples/movie-ratings/cortex.yaml @@ -1,2 +1,2 @@ -- kind: app +- kind: deployment name: movie-ratings diff --git a/examples/poker/cortex.yaml b/examples/poker/cortex.yaml index cd94bbce2b..65b7bff032 100644 --- a/examples/poker/cortex.yaml +++ b/examples/poker/cortex.yaml @@ -1,4 +1,4 @@ -- kind: app +- kind: deployment name: poker - kind: environment diff --git a/examples/reviews/cortex.yaml b/examples/reviews/cortex.yaml index 109c799afd..dd6a6af846 100644 --- a/examples/reviews/cortex.yaml +++ b/examples/reviews/cortex.yaml @@ -1,2 +1,2 @@ -- kind: app +- kind: deployment name: reviews diff --git a/examples/wine/cortex.yaml b/examples/wine/cortex.yaml index 49286d8bb7..20fc379429 100644 --- a/examples/wine/cortex.yaml +++ b/examples/wine/cortex.yaml @@ -1,2 +1,2 @@ -- kind: app +- kind: deployment name: wine diff --git a/pkg/operator/api/resource/type.go b/pkg/operator/api/resource/type.go index 8dd1b2f0e4..aa509e9cc8 100644 --- a/pkg/operator/api/resource/type.go +++ b/pkg/operator/api/resource/type.go @@ -45,7 +45,7 @@ const ( var ( types = []string{ "unknown", - "app", + "deployment", "raw_column", "transformed_column", "aggregate", @@ -64,7 +64,7 @@ var ( typePlurals = []string{ "unknown", - "apps", + "deployments", "raw_columns", "transformed_columns", "aggregates", diff --git a/pkg/operator/api/userconfig/errors.go b/pkg/operator/api/userconfig/errors.go index 4961d426e1..eb8ee0378d 100644 --- a/pkg/operator/api/userconfig/errors.go +++ b/pkg/operator/api/userconfig/errors.go @@ -245,7 +245,7 @@ func ErrorReadConfig() error { func ErrorMissingAppDefinition() error { return Error{ Kind: ErrMissingAppDefinition, - message: fmt.Sprintf("cortex.yaml must define an app resource"), + message: fmt.Sprintf("cortex.yaml must define a deployment resource"), } } diff --git a/pkg/operator/endpoints/errors.go b/pkg/operator/endpoints/errors.go index 23726066f1..938df26c52 100644 --- a/pkg/operator/endpoints/errors.go +++ b/pkg/operator/endpoints/errors.go @@ -132,7 +132,7 @@ func ErrorAuthForbidden() error { func ErrorAppNotDeployed(appName string) error { return Error{ Kind: ErrAuthForbidden, - message: fmt.Sprintf("app %s is not deployed", s.UserStr(appName)), + message: fmt.Sprintf("%s is not deployed", s.UserStr(appName)), } } diff --git a/pkg/operator/workloads/errors.go b/pkg/operator/workloads/errors.go index aa1b172e98..e6a951083f 100644 --- a/pkg/operator/workloads/errors.go +++ b/pkg/operator/workloads/errors.go @@ -106,14 +106,14 @@ func ErrorMoreThanOneWorkflow() error { func ErrorContextAppMismatch() error { return Error{ Kind: ErrContextAppMismatch, - message: "context apps do not match", + message: "context deployments do not match", } } func ErrorWorkflowAppMismatch() error { return Error{ Kind: ErrWorkflowAppMismatch, - message: "workflow apps do not match", + message: "workflow deployments do not match", } } diff --git a/pkg/workloads/tf_api/api.py b/pkg/workloads/tf_api/api.py index ecdf38079b..c15a756e53 100644 --- a/pkg/workloads/tf_api/api.py +++ b/pkg/workloads/tf_api/api.py @@ -302,8 +302,8 @@ def health(): return jsonify({"ok": True}) -@app.route("//", methods=["POST"]) -def predict(app_name, api_name): +@app.route("//", methods=["POST"]) +def predict(deployment_name, api_name): try: payload = request.get_json() except Exception as e: From 5b0c3190c188a605e17b5af083c4879bb2ee73b2 Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Sun, 23 Jun 2019 20:15:38 -0700 Subject: [PATCH 02/30] Update docs --- README.md | 100 ++++++++++++++--------------------------- docs/faq.md | 29 ------------ docs/operator/cli.md | 55 +++++++---------------- docs/summary.md | 1 - docs/tutorial.md | 103 ++++++++++--------------------------------- 5 files changed, 72 insertions(+), 216 deletions(-) delete mode 100644 docs/faq.md diff --git a/README.md b/README.md index 72d249a8ed..9c531a45f3 100644 --- a/README.md +++ b/README.md @@ -4,94 +4,54 @@ **Get started:** [Install](https://docs.cortex.dev/install) • [Tutorial](https://docs.cortex.dev/tutorial) • [Demo Video](https://www.youtube.com/watch?v=tgMjCOD_ufo) • [Docs](https://docs.cortex.dev) • [Examples](https://github.com/cortexlabs/cortex/tree/0.4/examples) -**Learn more:** [Website](https://cortex.dev) • [FAQ](https://docs.cortex.dev/faq) • [Blog](https://blog.cortex.dev) • [Subscribe](https://cortexlabs.us20.list-manage.com/subscribe?u=a1987373ab814f20961fd90b4&id=ae83491e1c) • [Twitter](https://twitter.com/cortex_deploy) • [Contact](mailto:hello@cortex.dev) +**Learn more:** [Website](https://cortex.dev) • [Blog](https://blog.cortex.dev) • [Subscribe](https://cortexlabs.us20.list-manage.com/subscribe?u=a1987373ab814f20961fd90b4&id=ae83491e1c) • [Twitter](https://twitter.com/cortex_deploy) • [Contact](mailto:hello@cortex.dev)
-## Deploy, manage, and scale machine learning applications +## Deploy machine learning models in production -Deploy machine learning applications without worrying about setting up infrastructure, managing dependencies, or orchestrating data pipelines. +Cortex deploys your machine learning models on your cloud infrastructure. You define your deployment with simple declarative configuration, Cortex containerizes your models, deploys them as scalable JSON APIs, and manages their lifecycle in production. Cortex is actively maintained by Cortex Labs. We're a venture-backed team of infrastructure engineers and [we're hiring](https://angel.co/cortex-labs-inc/jobs).
-## How it works +## Machine learning deployments as code -1. **Define your app:** define your application using Python, TensorFlow, and PySpark. - -2. **`$ cortex deploy`:** deploy end-to-end machine learning pipelines to AWS with one command. - -3. **Serve predictions:** serve real time predictions via horizontally scalable JSON APIs. - -
- -## End-to-end machine learning workflow - -**Data ingestion:** connect to your data warehouse and ingest data. +**Configure:** Define your deployment using simple declarative configuration. ```yaml -- kind: environment - name: dev - data: - type: csv - path: s3a://my-bucket/data.csv - schema: [@col1, @col2, ...] -``` - -**Data validation:** prevent data quality issues early. - -```yaml -- kind: raw_column - name: col1 - type: INT_COLUMN - min: 0 - max: 10 +- kind: api + name: my-api + model: s3://my-bucket/my-model.zip # TensorFlow / PyTorch + preprocessor: transform_payload.py # Transform request payloads before inference + postprocessor: process_prediction.py # Transform predicitons before responding to the client + compute: + replicas: 3 + GPU: 2 ``` -**Data transformation:** use custom Python and PySpark code to transform data. +**Deploy:** Cortex deploys your pipeline on scalable cloud infrastructure. -```yaml -- kind: transformed_column - name: col1_normalized - transformer_path: normalize.py # Python / PySpark code - input: @col1 ``` +$ cortex deploy -**Model training:** train models with custom TensorFlow code. +Provisioning infrastructure ... +Deploying API ... +Loading model ... -```yaml -- kind: model - name: my_model - estimator_path: dnn.py # TensorFlow code - target_column: @label_col - input: [@col1_normalized, @col2_indexed, ...] - hparams: - hidden_units: [16, 8] - training: - batch_size: 32 - num_steps: 10000 +Ready! https://amazonaws.com/my-api ``` -**Prediction serving:** serve real time predictions via JSON APIs. +**Manage:** Serve real time predictions via scalable JSON APIs. -```yaml -- kind: api - name: my-api - model: @my_model - compute: - replicas: 3 ``` +$ cortex status my-api -**Deployment:** Cortex deploys your pipeline on scalable cloud infrastructure. - -``` -$ cortex deploy -Ingesting data ... -Transforming data ... -Training models ... -Deploying API ... -Ready! https://abc.amazonaws.com/my-api +Endpoint: https://amazonaws.com/my-api +Latency: 200ms +Throughput: 50 requests per second +Predictions: 1,234,567 legitimate | 89 fraud ```
@@ -100,8 +60,12 @@ Ready! https://abc.amazonaws.com/my-api - **Machine learning pipelines as code:** Cortex deployments are defined using a simple declarative syntax that enables flexibility and reusability. -- **End-to-end machine learning workflow:** Cortex spans the machine learning workflow from feature management to model training to prediction serving. +- **Multi framework support:** Cortex supports [TensorFlow](https://www.tensorflow.org), [Keras](https://keras.io), and [PyTorch](https://pytorch.org) models. + +- **Scalability:** Cortex automatically handles scaling APIs. + +- **Rolling updates:** Cortex updates deployed APIs without any downtime. -- **TensorFlow and PySpark support:** Cortex supports custom [TensorFlow](https://www.tensorflow.org) code for model training and custom [PySpark](https://spark.apache.org/docs/latest/api/python/index.html) code for data processing. +- **A/B testing:** Cortex can load balance traffic across multiple models. -- **Built for the cloud:** Cortex can handle production workloads and can be deployed in any AWS account in minutes. +- **Cloud agnostic:** Cortex can handle production workloads and can be deployed on any Kubernetes cluster in minutes. diff --git a/docs/faq.md b/docs/faq.md deleted file mode 100644 index f2a4890279..0000000000 --- a/docs/faq.md +++ /dev/null @@ -1,29 +0,0 @@ -# FAQ - -## What is Cortex? - -Cortex is an open-source platform for building, deploying, and managing machine learning systems in production. - -## Who is Cortex for? - -Developers who want to build machine learning powered web services. - -## Who is maintaining Cortex? - -Cortex Labs. - -## Which cloud providers are supported? - -Cortex currently only runs on AWS. Our goal is to support all the major cloud platforms, but we are starting with AWS. - -## Which machine learning frameworks are supported? - -We are focusing on TensorFlow for now, but we aim to support all popular machine learning frameworks. - -## Why do I need a Kubernetes cluster? - -Cortex is built on top of Kubernetes to limit cloud provider lock-in. - -## Can I use Cortex with my existing codebase? - -Yes you can. Your custom packages will be installed and made available for use in the Cortex pipeline. diff --git a/docs/operator/cli.md b/docs/operator/cli.md index 1acc6ba29b..2804610cc9 100644 --- a/docs/operator/cli.md +++ b/docs/operator/cli.md @@ -9,12 +9,11 @@ Usage: cortex deploy [flags] Flags: - -e, --env string environment (default "dev") - -f, --force stop all running jobs - -h, --help help for deploy + -f, --force + -h, --help ``` -The `deploy` command sends all configuration and code to the operator. If all validations pass, the operator will attempt to create the desired state on the cluster. +The `deploy` command sends all deployment configuration and code to Cortex. If all validations pass, Cortex will attempt to create the desired state on the cluster. ## refresh @@ -25,12 +24,11 @@ Usage: cortex refresh [flags] Flags: - -e, --env string environment (default "dev") - -f, --force stop all running jobs - -h, --help help for refresh + -f, --force + -h, --help ``` -The `refresh` behaves similarly to the `deploy` command. The key difference is that `refresh` doesn't use any cached resource and will recreate all state using raw data from the data warehouse. +The `refresh` command behaves similarly to the `deploy` command. The key difference is that `refresh` doesn't use any cached resources. ## predict @@ -42,9 +40,8 @@ Usage: Flags: -d, --deployment string deployment name - -e, --env string environment (default "dev") - -h, --help help for predict -j, --json print the raw json response + -h, --help ``` The `predict` command converts samples from a JSON file into prediction requests and outputs the response. This command is useful for quickly testing model output. @@ -57,10 +54,9 @@ Delete a deployment. Usage: cortex delete [DEPLOYMENT_NAME] [flags] -Flags: - -e, --env string environment (default "dev") - -h, --help help for delete +Flags: -c, --keep-cache keep cached data for the deployment + -h, --help ``` The `delete` command deletes an deployment's resources from the cluster. @@ -73,23 +69,14 @@ Get information about resources. Usage: cortex get [RESOURCE_TYPE] [RESOURCE_NAME] [flags] -Resource Types: - raw_column - aggregate - transformed_column - training_dataset - model - api - Flags: -d, --deployment string deployment name - -e, --env string environment (default "dev") - -h, --help help for get - -s, --summary show summarized output + -s, --summary summarized view of resources -w, --watch re-run the command every 2 seconds + -h, --help ``` -The `get` command outputs the current state of all resources on the cluster. Specifying a resource name provides a more detailed view of the configuration and state of that particular resource. Using the `-s` or `--summary` flag will show a summarized view of all resource statuses. +The `get` command outputs the current state of all resources on the cluster. Specifying a resource name provides a more detailed view of the configuration and state of that particular resource. ## logs @@ -99,19 +86,10 @@ Get logs for a resource. Usage: cortex logs [RESOURCE_TYPE] RESOURCE_NAME [flags] -Resource Types: - raw_column - aggregate - transformed_column - training_dataset - model - api - Flags: -d, --deployment string deployment name - -e, --env string environment (default "dev") - -h, --help help for logs - -v, --verbose show verbose output + -v, --verbose + -h, --help ``` The `logs` command streams logs from the workload corresponding to the specified resource. For example, `cortex logs models dnn` will get the Cortex logs from the most recent training workload for `dnn`. Using the `-v` or `--verbose` flag will show all of the logs for the workload (not just Cortex's logs). @@ -125,8 +103,7 @@ Usage: cortex configure [flags] Flags: - -e, --env string environment (default "dev") - -h, --help help for configure + -h, --help ``` The `configure` command is used to connect to the Cortex cluster. The CLI needs a Cortex operator URL as well as valid AWS credentials in order to authenticate requests. @@ -151,5 +128,5 @@ Usage: cortex completion [flags] Flags: - -h, --help help for completion + -h, --help ``` diff --git a/docs/summary.md b/docs/summary.md index 38deecead6..67b39b6b0c 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -7,7 +7,6 @@ * [CLI Commands](operator/cli.md) * [Examples](https://github.com/cortexlabs/cortex/tree/master/examples) * [GitHub](https://github.com/cortexlabs/cortex) -* [FAQ](faq.md) ## Applications diff --git a/docs/tutorial.md b/docs/tutorial.md index 906f75deeb..b1ebee88e3 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -2,30 +2,19 @@ ## Prerequisites -1. An AWS account -1. A Kubernetes cluster running the Cortex operator ([installation instructions](operator/install.md)) -1. The Cortex CLI +1. A Kubernetes cluster running Cortex ([installation instructions](operator/install.md)) +2. The Cortex CLI -## Build a machine learning application +## Deployment -Let's build and deploy a classifier using the famous [iris data set](https://archive.ics.uci.edu/ml/datasets/iris)! Below are a few samples of iris data: - -|sepal_length|sepal_width|petal_length|petal_width|class| -|:---:|:---:|:---:|:---:|:---| -|5.1|3.5|1.4|0.2|Iris-setosa| -|7.0|3.2|4.7|1.4|Iris-versicolor| -|6.3|3.3|6.0|2.5|Iris-virginica| - -Our goal is to build a web API that returns the type of iris given its measurements. - -#### Initialize the deployment +### cortex.yaml ```bash -mkdir iris && cd iris -touch cortex.yaml irises.json +$ mkdir iris && cd iris +$ touch cortex.yaml irises.json ``` -Cortex requires an `cortex.yaml` file which defines a `deployment` resource. Other resources may be defined in arbitrarily named YAML files in the the directory which contains `cortex.yaml` or any subdirectories. For this example, we will define all of our resources in `cortex.yaml`. +Cortex requires a `cortex.yaml` file which defines a `deployment` resource. Other resources may be defined in arbitrarily named YAML files in the the directory which contains `cortex.yaml` or any subdirectories. We will define all of our resources in `cortex.yaml` in this example. Add to `cortex.yaml`: @@ -34,49 +23,9 @@ Add to `cortex.yaml`: name: iris ``` -#### Configure data ingestion - -Add to `cortex.yaml`: - -```yaml -# Environments - -- kind: environment - name: dev - data: - type: csv - path: s3a://cortex-examples/iris.csv - schema: [@sepal_length, @sepal_width, @petal_length, @petal_width, @class] -``` - -Cortex is able to read from any S3 bucket that your AWS credentials grant access to. - -#### Define the model +### Define an API -This configuration will generate a training dataset with the specified columns and train our classifier using the generated dataset. Here we're using a built-in estimator (which uses TensorFlow's [DNNClassifier](https://www.tensorflow.org/api_docs/python/tf/estimator/DNNClassifier)) but Cortex supports any TensorFlow code that adheres to the [tf.estimator API](https://www.tensorflow.org/guide/estimators). - -Add to `cortex.yaml`: - -```yaml -# Models - -- kind: model - name: dnn - estimator: cortex.dnn_classifier - target_column: @class - input: - numeric_columns: [@sepal_length, @sepal_width, @petal_length, @petal_width] - target_vocab: ['Iris-setosa', 'Iris-versicolor', 'Iris-virginica'] - hparams: - hidden_units: [4, 2] - training: - batch_size: 10 - num_steps: 1000 -``` - -#### Define web APIs - -This will make the model available as a live web service that can serve real-time predictions. +An API makes your model available as a live web service that can serve real-time predictions. Cortex is able to read from any S3 bucket that your AWS credentials grant access to. Add to `cortex.yaml`: @@ -85,26 +34,26 @@ Add to `cortex.yaml`: - kind: api name: iris-type - model: @dnn + model: + path: s3://cortex-examples/iris-tensorflow.zip + region: us-west-2 compute: - replicas: 2 + replicas: 3 ``` -## Create the deployment +### Deploy the API ``` $ cortex deploy - -Deployment started ``` -You can get a summary of the status of resources using `cortex status`: +You can get a summary of the status of resources using `cortex get`: ``` -$ cortex status --watch +$ cortex get --watch ``` -#### Test the iris classification service +### Test the iris classification service Define a sample in `irises.json`: @@ -127,32 +76,28 @@ When the API is ready, request a prediction from the API: $ cortex predict iris-type irises.json ``` -#### Call the API from other clients (e.g. cURL) +### Call the API from other clients (e.g. cURL) Get the API's endpoint: ``` -$ cortex get api iris-type +$ cortex get iris-type ``` Use cURL to test the API: ``` -$ curl -k \ - -X POST \ - -H "Content-Type: application/json" \ - -d '{ "samples": [ { "sepal_length": 5.2, "sepal_width": 3.6, "petal_length": 1.4, "petal_width": 0.3 } ] }' \ - +$ curl -k -X POST -H "Content-Type: application/json" \ + -d '{ "samples": [ { "sepal_length": 5.2, "sepal_width": 3.6, "petal_length": 1.4, "petal_width": 0.3 } ] }' \ + ``` -## Cleanup +### Cleanup -Delete the iris deployment: +Delete the deployment: ``` $ cortex delete iris - -Deployment deleted ``` See [uninstall](operator/uninstall.md) if you'd like to uninstall Cortex. From 670030d931e57ec740820ba30355d4433e1f119d Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 12:31:57 -0700 Subject: [PATCH 03/30] Reorganize files --- docs/{operator => cluster}/aws.md | 0 docs/{operator => cluster}/cli.md | 0 docs/{operator => cluster}/config.md | 0 docs/{operator => cluster}/install.md | 0 docs/{operator => cluster}/security.md | 0 docs/{operator => cluster}/uninstall.md | 0 .../advanced/compute.md | 0 .../advanced/external-models.md | 0 .../advanced/python-packages.md | 0 .../advanced/templates.md | 0 .../implementations/aggregators.md | 0 .../implementations/estimators.md | 0 .../implementations/transformers.md | 0 .../resources/aggregates.md | 0 .../resources/aggregators.md | 0 .../resources/apis.md | 0 .../resources/constants.md | 0 .../resources/data-types.md | 0 .../resources/deployment.md | 0 .../resources/environments.md | 0 .../resources/estimators.md | 0 .../resources/models.md | 0 .../resources/overview.md | 0 .../resources/raw-columns.md | 0 .../resources/statuses.md | 0 .../resources/transformed-columns.md | 0 .../resources/transformers.md | 0 docs/summary.md | 87 +++++++++---------- 28 files changed, 43 insertions(+), 44 deletions(-) rename docs/{operator => cluster}/aws.md (100%) rename docs/{operator => cluster}/cli.md (100%) rename docs/{operator => cluster}/config.md (100%) rename docs/{operator => cluster}/install.md (100%) rename docs/{operator => cluster}/security.md (100%) rename docs/{operator => cluster}/uninstall.md (100%) rename docs/{applications => deployments}/advanced/compute.md (100%) rename docs/{applications => deployments}/advanced/external-models.md (100%) rename docs/{applications => deployments}/advanced/python-packages.md (100%) rename docs/{applications => deployments}/advanced/templates.md (100%) rename docs/{applications => deployments}/implementations/aggregators.md (100%) rename docs/{applications => deployments}/implementations/estimators.md (100%) rename docs/{applications => deployments}/implementations/transformers.md (100%) rename docs/{applications => deployments}/resources/aggregates.md (100%) rename docs/{applications => deployments}/resources/aggregators.md (100%) rename docs/{applications => deployments}/resources/apis.md (100%) rename docs/{applications => deployments}/resources/constants.md (100%) rename docs/{applications => deployments}/resources/data-types.md (100%) rename docs/{applications => deployments}/resources/deployment.md (100%) rename docs/{applications => deployments}/resources/environments.md (100%) rename docs/{applications => deployments}/resources/estimators.md (100%) rename docs/{applications => deployments}/resources/models.md (100%) rename docs/{applications => deployments}/resources/overview.md (100%) rename docs/{applications => deployments}/resources/raw-columns.md (100%) rename docs/{applications => deployments}/resources/statuses.md (100%) rename docs/{applications => deployments}/resources/transformed-columns.md (100%) rename docs/{applications => deployments}/resources/transformers.md (100%) diff --git a/docs/operator/aws.md b/docs/cluster/aws.md similarity index 100% rename from docs/operator/aws.md rename to docs/cluster/aws.md diff --git a/docs/operator/cli.md b/docs/cluster/cli.md similarity index 100% rename from docs/operator/cli.md rename to docs/cluster/cli.md diff --git a/docs/operator/config.md b/docs/cluster/config.md similarity index 100% rename from docs/operator/config.md rename to docs/cluster/config.md diff --git a/docs/operator/install.md b/docs/cluster/install.md similarity index 100% rename from docs/operator/install.md rename to docs/cluster/install.md diff --git a/docs/operator/security.md b/docs/cluster/security.md similarity index 100% rename from docs/operator/security.md rename to docs/cluster/security.md diff --git a/docs/operator/uninstall.md b/docs/cluster/uninstall.md similarity index 100% rename from docs/operator/uninstall.md rename to docs/cluster/uninstall.md diff --git a/docs/applications/advanced/compute.md b/docs/deployments/advanced/compute.md similarity index 100% rename from docs/applications/advanced/compute.md rename to docs/deployments/advanced/compute.md diff --git a/docs/applications/advanced/external-models.md b/docs/deployments/advanced/external-models.md similarity index 100% rename from docs/applications/advanced/external-models.md rename to docs/deployments/advanced/external-models.md diff --git a/docs/applications/advanced/python-packages.md b/docs/deployments/advanced/python-packages.md similarity index 100% rename from docs/applications/advanced/python-packages.md rename to docs/deployments/advanced/python-packages.md diff --git a/docs/applications/advanced/templates.md b/docs/deployments/advanced/templates.md similarity index 100% rename from docs/applications/advanced/templates.md rename to docs/deployments/advanced/templates.md diff --git a/docs/applications/implementations/aggregators.md b/docs/deployments/implementations/aggregators.md similarity index 100% rename from docs/applications/implementations/aggregators.md rename to docs/deployments/implementations/aggregators.md diff --git a/docs/applications/implementations/estimators.md b/docs/deployments/implementations/estimators.md similarity index 100% rename from docs/applications/implementations/estimators.md rename to docs/deployments/implementations/estimators.md diff --git a/docs/applications/implementations/transformers.md b/docs/deployments/implementations/transformers.md similarity index 100% rename from docs/applications/implementations/transformers.md rename to docs/deployments/implementations/transformers.md diff --git a/docs/applications/resources/aggregates.md b/docs/deployments/resources/aggregates.md similarity index 100% rename from docs/applications/resources/aggregates.md rename to docs/deployments/resources/aggregates.md diff --git a/docs/applications/resources/aggregators.md b/docs/deployments/resources/aggregators.md similarity index 100% rename from docs/applications/resources/aggregators.md rename to docs/deployments/resources/aggregators.md diff --git a/docs/applications/resources/apis.md b/docs/deployments/resources/apis.md similarity index 100% rename from docs/applications/resources/apis.md rename to docs/deployments/resources/apis.md diff --git a/docs/applications/resources/constants.md b/docs/deployments/resources/constants.md similarity index 100% rename from docs/applications/resources/constants.md rename to docs/deployments/resources/constants.md diff --git a/docs/applications/resources/data-types.md b/docs/deployments/resources/data-types.md similarity index 100% rename from docs/applications/resources/data-types.md rename to docs/deployments/resources/data-types.md diff --git a/docs/applications/resources/deployment.md b/docs/deployments/resources/deployment.md similarity index 100% rename from docs/applications/resources/deployment.md rename to docs/deployments/resources/deployment.md diff --git a/docs/applications/resources/environments.md b/docs/deployments/resources/environments.md similarity index 100% rename from docs/applications/resources/environments.md rename to docs/deployments/resources/environments.md diff --git a/docs/applications/resources/estimators.md b/docs/deployments/resources/estimators.md similarity index 100% rename from docs/applications/resources/estimators.md rename to docs/deployments/resources/estimators.md diff --git a/docs/applications/resources/models.md b/docs/deployments/resources/models.md similarity index 100% rename from docs/applications/resources/models.md rename to docs/deployments/resources/models.md diff --git a/docs/applications/resources/overview.md b/docs/deployments/resources/overview.md similarity index 100% rename from docs/applications/resources/overview.md rename to docs/deployments/resources/overview.md diff --git a/docs/applications/resources/raw-columns.md b/docs/deployments/resources/raw-columns.md similarity index 100% rename from docs/applications/resources/raw-columns.md rename to docs/deployments/resources/raw-columns.md diff --git a/docs/applications/resources/statuses.md b/docs/deployments/resources/statuses.md similarity index 100% rename from docs/applications/resources/statuses.md rename to docs/deployments/resources/statuses.md diff --git a/docs/applications/resources/transformed-columns.md b/docs/deployments/resources/transformed-columns.md similarity index 100% rename from docs/applications/resources/transformed-columns.md rename to docs/deployments/resources/transformed-columns.md diff --git a/docs/applications/resources/transformers.md b/docs/deployments/resources/transformers.md similarity index 100% rename from docs/applications/resources/transformers.md rename to docs/deployments/resources/transformers.md diff --git a/docs/summary.md b/docs/summary.md index 67b39b6b0c..a93bcd7c3d 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -1,48 +1,47 @@ # Summary -* [Read Me](../README.md) -* [Install](operator/install.md) +* [README](../README.md) +* [Install](cluster/install.md) * [Tutorial](tutorial.md) -* [Application Overview](applications/resources/overview.md) -* [CLI Commands](operator/cli.md) +* [CLI Commands](cluster/cli.md) * [Examples](https://github.com/cortexlabs/cortex/tree/master/examples) -* [GitHub](https://github.com/cortexlabs/cortex) - -## Applications - -### Resources - - * [Application](applications/resources/deployment.md) - * [Environments](applications/resources/environments.md) - * [Raw Columns](applications/resources/raw-columns.md) - * [Aggregators](applications/resources/aggregators.md) - * [Aggregates](applications/resources/aggregates.md) - * [Transformers](applications/resources/transformers.md) - * [Transformed Columns](applications/resources/transformed-columns.md) - * [Estimators](applications/resources/estimators.md) - * [Models](applications/resources/models.md) - * [APIs](applications/resources/apis.md) - * [Constants](applications/resources/constants.md) - * [Data Types](applications/resources/data-types.md) - * [Resource Statuses](applications/resources/statuses.md) - -### Implementations - - * [Aggregators](applications/implementations/aggregators.md) - * [Transformers](applications/implementations/transformers.md) - * [Estimators](applications/implementations/estimators.md) - -### Advanced - - * [Templates](applications/advanced/templates.md) - * [Compute](applications/advanced/compute.md) - * [Python Packages](applications/advanced/python-packages.md) - * [Development](development.md) - * [Importing External Models](applications/advanced/external-models.md) - -## Operator - - * [AWS Credentials](operator/aws.md) - * [Config](operator/config.md) - * [Security](operator/security.md) - * [Uninstall](operator/uninstall.md) + +## Model Deployment + +* [Deployment](applications/resources/deployment.md) +* [APIs](applications/resources/apis.md) + +## Pipeline Deployment + +* [Pipeline Overview](applications/resources/overview.md) +* [Deployment](applications/resources/deployment.md) +* [Environments](applications/resources/environments.md) +* [Raw Columns](applications/resources/raw-columns.md) +* [Aggregators](applications/resources/aggregators.md) +* [Custom Aggregators](applications/implementations/aggregators.md) +* [Aggregates](applications/resources/aggregates.md) +* [Transformers](applications/resources/transformers.md) +* [Custom Transformers](applications/implementations/transformers.md) +* [Transformed Columns](applications/resources/transformed-columns.md) +* [Estimators](applications/resources/estimators.md) +* [Custom Estimators](applications/implementations/estimators.md) +* [Models](applications/resources/models.md) +* [APIs](applications/resources/apis.md) +* [Constants](applications/resources/constants.md) +* [Data Types](applications/resources/data-types.md) +* [Resource Statuses](applications/resources/statuses.md) + +## Advanced + +* [Templates](applications/advanced/templates.md) +* [Compute](applications/advanced/compute.md) +* [Python Packages](applications/advanced/python-packages.md) +* [Importing External Models](applications/advanced/external-models.md) + +## Cluster + +* [Development](development.md) +* [AWS Credentials](cluster/aws.md) +* [Config](cluster/config.md) +* [Security](cluster/security.md) +* [Uninstall](cluster/uninstall.md) From e9815bac7786275e02aae569e4594e0a722d4e4d Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 12:34:26 -0700 Subject: [PATCH 04/30] Update summary.md --- docs/summary.md | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/summary.md b/docs/summary.md index a93bcd7c3d..3baba0e92c 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -8,35 +8,35 @@ ## Model Deployment -* [Deployment](applications/resources/deployment.md) -* [APIs](applications/resources/apis.md) +* [Deployments](deployments/resources/deployment.md) +* [APIs](deployments/resources/apis.md) ## Pipeline Deployment -* [Pipeline Overview](applications/resources/overview.md) -* [Deployment](applications/resources/deployment.md) -* [Environments](applications/resources/environments.md) -* [Raw Columns](applications/resources/raw-columns.md) -* [Aggregators](applications/resources/aggregators.md) -* [Custom Aggregators](applications/implementations/aggregators.md) -* [Aggregates](applications/resources/aggregates.md) -* [Transformers](applications/resources/transformers.md) -* [Custom Transformers](applications/implementations/transformers.md) -* [Transformed Columns](applications/resources/transformed-columns.md) -* [Estimators](applications/resources/estimators.md) -* [Custom Estimators](applications/implementations/estimators.md) -* [Models](applications/resources/models.md) -* [APIs](applications/resources/apis.md) -* [Constants](applications/resources/constants.md) -* [Data Types](applications/resources/data-types.md) -* [Resource Statuses](applications/resources/statuses.md) +* [Pipeline Overview](deployments/resources/overview.md) +* [Deployments](deployments/resources/deployment.md) +* [Environments](deployments/resources/environments.md) +* [Raw Columns](deployments/resources/raw-columns.md) +* [Aggregators](deployments/resources/aggregators.md) +* [Custom Aggregators](deployments/implementations/aggregators.md) +* [Aggregates](deployments/resources/aggregates.md) +* [Transformers](deployments/resources/transformers.md) +* [Custom Transformers](deployments/implementations/transformers.md) +* [Transformed Columns](deployments/resources/transformed-columns.md) +* [Estimators](deployments/resources/estimators.md) +* [Custom Estimators](deployments/implementations/estimators.md) +* [Models](deployments/resources/models.md) +* [APIs](deployments/resources/apis.md) +* [Constants](deployments/resources/constants.md) +* [Data Types](deployments/resources/data-types.md) +* [Resource Statuses](deployments/resources/statuses.md) ## Advanced -* [Templates](applications/advanced/templates.md) -* [Compute](applications/advanced/compute.md) -* [Python Packages](applications/advanced/python-packages.md) -* [Importing External Models](applications/advanced/external-models.md) +* [Templates](deployments/advanced/templates.md) +* [Compute](deployments/advanced/compute.md) +* [Python Packages](deployments/advanced/python-packages.md) +* [Importing External Models](deployments/advanced/external-models.md) ## Cluster From 4cc318ac7635d28b1f0f69332ead055c71ea8ab1 Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 12:56:54 -0700 Subject: [PATCH 05/30] Update docs --- README.md | 2 +- docs/deployments/advanced/compute.md | 2 ++ docs/deployments/advanced/external-models.md | 31 ------------------- docs/deployments/advanced/importing-models.md | 26 ++++++++++++++++ docs/deployments/resources/apis.md | 14 +++++---- docs/summary.md | 3 +- 6 files changed, 39 insertions(+), 39 deletions(-) delete mode 100644 docs/deployments/advanced/external-models.md create mode 100644 docs/deployments/advanced/importing-models.md diff --git a/README.md b/README.md index 9c531a45f3..23eb45ff7c 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Cortex is actively maintained by Cortex Labs. We're a venture-backed team of inf postprocessor: process_prediction.py # Transform predicitons before responding to the client compute: replicas: 3 - GPU: 2 + gpu: 2 ``` **Deploy:** Cortex deploys your pipeline on scalable cloud infrastructure. diff --git a/docs/deployments/advanced/compute.md b/docs/deployments/advanced/compute.md index 56029af150..c331360257 100644 --- a/docs/deployments/advanced/compute.md +++ b/docs/deployments/advanced/compute.md @@ -24,7 +24,9 @@ One unit of CPU corresponds to one virtual CPU on AWS. Fractional requests are a One unit of memory is one byte. Memory can be expressed as an integer or by using one of these suffixes: `K`, `M`, `G`, `T` (or their power-of two counterparts: `Ki`, `Mi`, `Gi`, `Ti`). For example, the following values represent roughly the same memory: `128974848`, `129e6`, `129M`, `123Mi`. ## GPU + One unit of GPU corresponds to one virtual GPU on AWS. Fractional requests are not allowed. Here's some information on [adding GPU enabled nodes on EKS](https://docs.aws.amazon.com/en_ca/eks/latest/userguide/gpu-ami.html). ## GPU Support + We recommend using GPU compute requests on API resources only if you have enough nodes in your cluster to support the number of GPU requests in model training plus APIs (ideally with an autoscaler). Otherwise, due to the nature of zero downtime rolling updates, your model training will not have sufficient GPU resources as there will always be GPUs consumed by APIs from the previous deployment. diff --git a/docs/deployments/advanced/external-models.md b/docs/deployments/advanced/external-models.md deleted file mode 100644 index b68a781b49..0000000000 --- a/docs/deployments/advanced/external-models.md +++ /dev/null @@ -1,31 +0,0 @@ -# Importing External Models - -You can serve a model that was trained outside of Cortex as an API. - -1. Zip the exported estimator output in your checkpoint directory, e.g. - -```bash -$ ls export/estimator -saved_model.pb variables/ - -$ zip -r model.zip export/estimator -``` - -2. Upload the zipped file to Amazon S3, e.g. - -```bash -$ aws s3 cp model.zip s3://your-bucket/model.zip -``` - -3. Specify `external_model` in an API, e.g. - -```yaml -- kind: api - name: my-api - external_model: - path: s3://my-bucket/model.zip - region: us-west-2 - compute: - replicas: 5 - gpu: 1 -``` diff --git a/docs/deployments/advanced/importing-models.md b/docs/deployments/advanced/importing-models.md new file mode 100644 index 0000000000..186348a3a9 --- /dev/null +++ b/docs/deployments/advanced/importing-models.md @@ -0,0 +1,26 @@ +# Importing Models + +## TensorFlow + +1. Zip the exported estimator output in your checkpoint directory, e.g. + +```bash +$ ls export/estimator +saved_model.pb variables/ + +$ zip -r model.zip export/estimator +``` + +1. Upload the zipped file to Amazon S3, e.g. + +```bash +$ aws s3 cp model.zip s3://your-bucket/model.zip +``` + +1. Specify `model` in an API, e.g. + +```yaml +- kind: api + name: my-api + model: s3://my-bucket/model.zip +``` diff --git a/docs/deployments/resources/apis.md b/docs/deployments/resources/apis.md index e55d89d18a..709a794371 100644 --- a/docs/deployments/resources/apis.md +++ b/docs/deployments/resources/apis.md @@ -7,10 +7,9 @@ Serve models at scale and use them to build smarter applications. ```yaml - kind: api name: # API name (required) - model: # reference to a model (e.g. @dnn) (this or external_model must be specified) - external_model: # (this or model must be specified) - path: # path to a zipped model dir (e.g. s3://my-bucket/model.zip) - region: # S3 region (default: us-west-2) + model: # reference to a model (e.g. s3://my-bucket/my-model.zip) + preprocessor: # path to the implementation file, relative to the cortex root (default: .py) + postprocessor: # path to the implementation file, relative to the cortex root (default: .py) compute: replicas: # number of replicas to launch (default: 1) cpu: # CPU request (default: Null) @@ -22,10 +21,13 @@ Serve models at scale and use them to build smarter applications. ```yaml - kind: api - name: classifier - model: @dnn + name: my-api + model: s3://my-bucket/my-model.zip + preprocessor: transform_payload.py + postprocessor: process_prediction.py compute: replicas: 3 + gpu: 2 ``` ## Integration diff --git a/docs/summary.md b/docs/summary.md index 3baba0e92c..36d38ed276 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -10,6 +10,8 @@ * [Deployments](deployments/resources/deployment.md) * [APIs](deployments/resources/apis.md) +* [Importing Models](deployments/advanced/importing-models.md) +* [Compute](deployments/advanced/compute.md) ## Pipeline Deployment @@ -36,7 +38,6 @@ * [Templates](deployments/advanced/templates.md) * [Compute](deployments/advanced/compute.md) * [Python Packages](deployments/advanced/python-packages.md) -* [Importing External Models](deployments/advanced/external-models.md) ## Cluster From 3a00a29f4018a4a20e8584eaf35c9eeb961a0af0 Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 15:01:10 -0700 Subject: [PATCH 06/30] Update iris example --- README.md | 10 ++++---- examples/external-model/cortex.yaml | 10 -------- examples/iris/cortex.yaml | 24 ++----------------- examples/iris/irises.json | 10 -------- .../{external-model => iris}/samples.json | 0 5 files changed, 7 insertions(+), 47 deletions(-) delete mode 100644 examples/external-model/cortex.yaml delete mode 100644 examples/iris/irises.json rename examples/{external-model => iris}/samples.json (100%) diff --git a/README.md b/README.md index 23eb45ff7c..ee290b27b4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@
-## Deploy machine learning models in production +## Deployment platform for machine learning in production Cortex deploys your machine learning models on your cloud infrastructure. You define your deployment with simple declarative configuration, Cortex containerizes your models, deploys them as scalable JSON APIs, and manages their lifecycle in production. @@ -18,7 +18,7 @@ Cortex is actively maintained by Cortex Labs. We're a venture-backed team of inf ## Machine learning deployments as code -**Configure:** Define your deployment using simple declarative configuration. +**Define** your deployment using declarative configuration. ```yaml - kind: api @@ -31,7 +31,7 @@ Cortex is actively maintained by Cortex Labs. We're a venture-backed team of inf gpu: 2 ``` -**Deploy:** Cortex deploys your pipeline on scalable cloud infrastructure. +**Deploy** to your cloud infrastructure. ``` $ cortex deploy @@ -43,7 +43,7 @@ Loading model ... Ready! https://amazonaws.com/my-api ``` -**Manage:** Serve real time predictions via scalable JSON APIs. +**Serve** real time predictions via scalable JSON APIs. ``` $ cortex status my-api @@ -58,7 +58,7 @@ Predictions: 1,234,567 legitimate | 89 fraud ## Key features -- **Machine learning pipelines as code:** Cortex deployments are defined using a simple declarative syntax that enables flexibility and reusability. +- **Machine learning deployments as code:** Cortex deployments are defined using a simple declarative syntax that enables flexibility and reusability. - **Multi framework support:** Cortex supports [TensorFlow](https://www.tensorflow.org), [Keras](https://keras.io), and [PyTorch](https://pytorch.org) models. diff --git a/examples/external-model/cortex.yaml b/examples/external-model/cortex.yaml deleted file mode 100644 index 50d96fdc27..0000000000 --- a/examples/external-model/cortex.yaml +++ /dev/null @@ -1,10 +0,0 @@ -- kind: deployment - name: external-model - -- kind: api - name: iris - external_model: - path: s3://cortex-examples/iris-model.zip - region: us-west-2 - compute: - replicas: 1 diff --git a/examples/iris/cortex.yaml b/examples/iris/cortex.yaml index b906d34a64..927787f689 100644 --- a/examples/iris/cortex.yaml +++ b/examples/iris/cortex.yaml @@ -1,28 +1,8 @@ - kind: deployment name: iris -- kind: environment - name: dev - data: - type: csv - path: s3a://cortex-examples/iris.csv - schema: [@sepal_length, @sepal_width, @petal_length, @petal_width, @class] - -- kind: model - name: dnn - estimator: cortex.dnn_classifier - target_column: @class - input: - numeric_columns: [@sepal_length, @sepal_width, @petal_length, @petal_width] - target_vocab: ["Iris-setosa", "Iris-versicolor", "Iris-virginica"] - hparams: - hidden_units: [4, 2] - training: - batch_size: 10 - num_steps: 1000 - - kind: api name: iris-type - model: @dnn + model: s3://cortex-examples/iris-model.zip compute: - replicas: 1 + replicas: 3 diff --git a/examples/iris/irises.json b/examples/iris/irises.json deleted file mode 100644 index 33d1e6a5b5..0000000000 --- a/examples/iris/irises.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "samples": [ - { - "sepal_length": 5.2, - "sepal_width": 3.6, - "petal_length": 1.4, - "petal_width": 0.3 - } - ] -} diff --git a/examples/external-model/samples.json b/examples/iris/samples.json similarity index 100% rename from examples/external-model/samples.json rename to examples/iris/samples.json From 5c9889089ab77febb89471f7604a3e7eb1dd5117 Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 15:26:32 -0700 Subject: [PATCH 07/30] Update examples --- docs/summary.md | 3 +- examples/{ => pipelines}/fraud/cortex.yaml | 0 .../implementations/transformers/weight.py | 0 .../{ => pipelines}/fraud/resources/apis.yaml | 0 .../fraud/resources/models.yaml | 0 .../fraud/resources/normalized_columns.yaml | 0 .../fraud/resources/raw_columns.yaml | 0 .../fraud/resources/weight_column.yaml | 0 .../{ => pipelines}/fraud/transactions.json | 0 .../{ => pipelines}/insurance/cortex.yaml | 0 .../{ => pipelines}/insurance/customers.json | 0 .../insurance/resources/apis.yaml | 0 .../insurance/resources/data.yaml | 0 .../insurance/resources/features.yaml | 0 .../insurance/resources/models.yaml | 0 examples/pipelines/iris/cortex.yaml | 28 +++++++++++++++++++ examples/pipelines/iris/samples.json | 10 +++++++ examples/{ => pipelines}/mnist/cortex.yaml | 0 examples/{ => pipelines}/mnist/digit.json | 0 .../mnist/implementations/models/custom.py | 0 .../mnist/implementations/models/dnn.py | 0 .../mnist/implementations/models/t2t.py | 0 .../transformers/decode_and_normalize.py | 0 .../{ => pipelines}/mnist/requirements.txt | 0 .../{ => pipelines}/mnist/resources/apis.yaml | 0 .../{ => pipelines}/mnist/resources/data.yaml | 0 .../mnist/resources/models.yaml | 0 .../{ => pipelines}/movie-ratings/cortex.yaml | 0 .../implementations/models/basic_embedding.py | 0 .../{ => pipelines}/movie-ratings/movies.json | 0 .../movie-ratings/resources/apis.yaml | 0 .../movie-ratings/resources/data.yaml | 0 .../movie-ratings/resources/models.yaml | 0 examples/{ => pipelines}/poker/cortex.yaml | 0 examples/{ => pipelines}/poker/hands.json | 0 examples/{ => pipelines}/reviews/cortex.yaml | 0 .../implementations/aggregators/max_length.py | 0 .../implementations/aggregators/vocab.py | 0 .../implementations/models/sentiment_dnn.py | 0 .../models/sentiment_linear.py | 0 .../implementations/models/transformer.py | 0 .../transformers/tokenize_string_to_int.py | 0 .../{ => pipelines}/reviews/requirements.txt | 0 .../reviews/resources/apis.yaml | 0 .../reviews/resources/data.yaml | 0 .../reviews/resources/models.yaml | 0 examples/{ => pipelines}/reviews/reviews.json | 0 examples/{ => pipelines}/wine/cortex.yaml | 0 .../{ => pipelines}/wine/resources/apis.yaml | 0 .../{ => pipelines}/wine/resources/data.yaml | 0 .../wine/resources/models.yaml | 0 .../wine/resources/normalized_columns.yaml | 0 .../wine/resources/quality.yaml | 0 examples/{ => pipelines}/wine/wines.json | 0 54 files changed, 40 insertions(+), 1 deletion(-) rename examples/{ => pipelines}/fraud/cortex.yaml (100%) rename examples/{ => pipelines}/fraud/implementations/transformers/weight.py (100%) rename examples/{ => pipelines}/fraud/resources/apis.yaml (100%) rename examples/{ => pipelines}/fraud/resources/models.yaml (100%) rename examples/{ => pipelines}/fraud/resources/normalized_columns.yaml (100%) rename examples/{ => pipelines}/fraud/resources/raw_columns.yaml (100%) rename examples/{ => pipelines}/fraud/resources/weight_column.yaml (100%) rename examples/{ => pipelines}/fraud/transactions.json (100%) rename examples/{ => pipelines}/insurance/cortex.yaml (100%) rename examples/{ => pipelines}/insurance/customers.json (100%) rename examples/{ => pipelines}/insurance/resources/apis.yaml (100%) rename examples/{ => pipelines}/insurance/resources/data.yaml (100%) rename examples/{ => pipelines}/insurance/resources/features.yaml (100%) rename examples/{ => pipelines}/insurance/resources/models.yaml (100%) create mode 100644 examples/pipelines/iris/cortex.yaml create mode 100644 examples/pipelines/iris/samples.json rename examples/{ => pipelines}/mnist/cortex.yaml (100%) rename examples/{ => pipelines}/mnist/digit.json (100%) rename examples/{ => pipelines}/mnist/implementations/models/custom.py (100%) rename examples/{ => pipelines}/mnist/implementations/models/dnn.py (100%) rename examples/{ => pipelines}/mnist/implementations/models/t2t.py (100%) rename examples/{ => pipelines}/mnist/implementations/transformers/decode_and_normalize.py (100%) rename examples/{ => pipelines}/mnist/requirements.txt (100%) rename examples/{ => pipelines}/mnist/resources/apis.yaml (100%) rename examples/{ => pipelines}/mnist/resources/data.yaml (100%) rename examples/{ => pipelines}/mnist/resources/models.yaml (100%) rename examples/{ => pipelines}/movie-ratings/cortex.yaml (100%) rename examples/{ => pipelines}/movie-ratings/implementations/models/basic_embedding.py (100%) rename examples/{ => pipelines}/movie-ratings/movies.json (100%) rename examples/{ => pipelines}/movie-ratings/resources/apis.yaml (100%) rename examples/{ => pipelines}/movie-ratings/resources/data.yaml (100%) rename examples/{ => pipelines}/movie-ratings/resources/models.yaml (100%) rename examples/{ => pipelines}/poker/cortex.yaml (100%) rename examples/{ => pipelines}/poker/hands.json (100%) rename examples/{ => pipelines}/reviews/cortex.yaml (100%) rename examples/{ => pipelines}/reviews/implementations/aggregators/max_length.py (100%) rename examples/{ => pipelines}/reviews/implementations/aggregators/vocab.py (100%) rename examples/{ => pipelines}/reviews/implementations/models/sentiment_dnn.py (100%) rename examples/{ => pipelines}/reviews/implementations/models/sentiment_linear.py (100%) rename examples/{ => pipelines}/reviews/implementations/models/transformer.py (100%) rename examples/{ => pipelines}/reviews/implementations/transformers/tokenize_string_to_int.py (100%) rename examples/{ => pipelines}/reviews/requirements.txt (100%) rename examples/{ => pipelines}/reviews/resources/apis.yaml (100%) rename examples/{ => pipelines}/reviews/resources/data.yaml (100%) rename examples/{ => pipelines}/reviews/resources/models.yaml (100%) rename examples/{ => pipelines}/reviews/reviews.json (100%) rename examples/{ => pipelines}/wine/cortex.yaml (100%) rename examples/{ => pipelines}/wine/resources/apis.yaml (100%) rename examples/{ => pipelines}/wine/resources/data.yaml (100%) rename examples/{ => pipelines}/wine/resources/models.yaml (100%) rename examples/{ => pipelines}/wine/resources/normalized_columns.yaml (100%) rename examples/{ => pipelines}/wine/resources/quality.yaml (100%) rename examples/{ => pipelines}/wine/wines.json (100%) diff --git a/docs/summary.md b/docs/summary.md index 36d38ed276..4d8bc56b12 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -3,7 +3,6 @@ * [README](../README.md) * [Install](cluster/install.md) * [Tutorial](tutorial.md) -* [CLI Commands](cluster/cli.md) * [Examples](https://github.com/cortexlabs/cortex/tree/master/examples) ## Model Deployment @@ -12,6 +11,7 @@ * [APIs](deployments/resources/apis.md) * [Importing Models](deployments/advanced/importing-models.md) * [Compute](deployments/advanced/compute.md) +* [CLI Commands](cluster/cli.md) ## Pipeline Deployment @@ -32,6 +32,7 @@ * [Constants](deployments/resources/constants.md) * [Data Types](deployments/resources/data-types.md) * [Resource Statuses](deployments/resources/statuses.md) +* [CLI Commands](cluster/cli.md) ## Advanced diff --git a/examples/fraud/cortex.yaml b/examples/pipelines/fraud/cortex.yaml similarity index 100% rename from examples/fraud/cortex.yaml rename to examples/pipelines/fraud/cortex.yaml diff --git a/examples/fraud/implementations/transformers/weight.py b/examples/pipelines/fraud/implementations/transformers/weight.py similarity index 100% rename from examples/fraud/implementations/transformers/weight.py rename to examples/pipelines/fraud/implementations/transformers/weight.py diff --git a/examples/fraud/resources/apis.yaml b/examples/pipelines/fraud/resources/apis.yaml similarity index 100% rename from examples/fraud/resources/apis.yaml rename to examples/pipelines/fraud/resources/apis.yaml diff --git a/examples/fraud/resources/models.yaml b/examples/pipelines/fraud/resources/models.yaml similarity index 100% rename from examples/fraud/resources/models.yaml rename to examples/pipelines/fraud/resources/models.yaml diff --git a/examples/fraud/resources/normalized_columns.yaml b/examples/pipelines/fraud/resources/normalized_columns.yaml similarity index 100% rename from examples/fraud/resources/normalized_columns.yaml rename to examples/pipelines/fraud/resources/normalized_columns.yaml diff --git a/examples/fraud/resources/raw_columns.yaml b/examples/pipelines/fraud/resources/raw_columns.yaml similarity index 100% rename from examples/fraud/resources/raw_columns.yaml rename to examples/pipelines/fraud/resources/raw_columns.yaml diff --git a/examples/fraud/resources/weight_column.yaml b/examples/pipelines/fraud/resources/weight_column.yaml similarity index 100% rename from examples/fraud/resources/weight_column.yaml rename to examples/pipelines/fraud/resources/weight_column.yaml diff --git a/examples/fraud/transactions.json b/examples/pipelines/fraud/transactions.json similarity index 100% rename from examples/fraud/transactions.json rename to examples/pipelines/fraud/transactions.json diff --git a/examples/insurance/cortex.yaml b/examples/pipelines/insurance/cortex.yaml similarity index 100% rename from examples/insurance/cortex.yaml rename to examples/pipelines/insurance/cortex.yaml diff --git a/examples/insurance/customers.json b/examples/pipelines/insurance/customers.json similarity index 100% rename from examples/insurance/customers.json rename to examples/pipelines/insurance/customers.json diff --git a/examples/insurance/resources/apis.yaml b/examples/pipelines/insurance/resources/apis.yaml similarity index 100% rename from examples/insurance/resources/apis.yaml rename to examples/pipelines/insurance/resources/apis.yaml diff --git a/examples/insurance/resources/data.yaml b/examples/pipelines/insurance/resources/data.yaml similarity index 100% rename from examples/insurance/resources/data.yaml rename to examples/pipelines/insurance/resources/data.yaml diff --git a/examples/insurance/resources/features.yaml b/examples/pipelines/insurance/resources/features.yaml similarity index 100% rename from examples/insurance/resources/features.yaml rename to examples/pipelines/insurance/resources/features.yaml diff --git a/examples/insurance/resources/models.yaml b/examples/pipelines/insurance/resources/models.yaml similarity index 100% rename from examples/insurance/resources/models.yaml rename to examples/pipelines/insurance/resources/models.yaml diff --git a/examples/pipelines/iris/cortex.yaml b/examples/pipelines/iris/cortex.yaml new file mode 100644 index 0000000000..34ff5d2fad --- /dev/null +++ b/examples/pipelines/iris/cortex.yaml @@ -0,0 +1,28 @@ +- kind: app + name: iris + +- kind: environment + name: dev + data: + type: csv + path: s3a://cortex-examples/iris.csv + schema: [@sepal_length, @sepal_width, @petal_length, @petal_width, @class] + +- kind: model + name: dnn + estimator: cortex.dnn_classifier + target_column: @class + input: + numeric_columns: [@sepal_length, @sepal_width, @petal_length, @petal_width] + target_vocab: ["Iris-setosa", "Iris-versicolor", "Iris-virginica"] + hparams: + hidden_units: [4, 2] + training: + batch_size: 10 + num_steps: 1000 + +- kind: api + name: iris-type + model: @dnn + compute: + replicas: 1 diff --git a/examples/pipelines/iris/samples.json b/examples/pipelines/iris/samples.json new file mode 100644 index 0000000000..33d1e6a5b5 --- /dev/null +++ b/examples/pipelines/iris/samples.json @@ -0,0 +1,10 @@ +{ + "samples": [ + { + "sepal_length": 5.2, + "sepal_width": 3.6, + "petal_length": 1.4, + "petal_width": 0.3 + } + ] +} diff --git a/examples/mnist/cortex.yaml b/examples/pipelines/mnist/cortex.yaml similarity index 100% rename from examples/mnist/cortex.yaml rename to examples/pipelines/mnist/cortex.yaml diff --git a/examples/mnist/digit.json b/examples/pipelines/mnist/digit.json similarity index 100% rename from examples/mnist/digit.json rename to examples/pipelines/mnist/digit.json diff --git a/examples/mnist/implementations/models/custom.py b/examples/pipelines/mnist/implementations/models/custom.py similarity index 100% rename from examples/mnist/implementations/models/custom.py rename to examples/pipelines/mnist/implementations/models/custom.py diff --git a/examples/mnist/implementations/models/dnn.py b/examples/pipelines/mnist/implementations/models/dnn.py similarity index 100% rename from examples/mnist/implementations/models/dnn.py rename to examples/pipelines/mnist/implementations/models/dnn.py diff --git a/examples/mnist/implementations/models/t2t.py b/examples/pipelines/mnist/implementations/models/t2t.py similarity index 100% rename from examples/mnist/implementations/models/t2t.py rename to examples/pipelines/mnist/implementations/models/t2t.py diff --git a/examples/mnist/implementations/transformers/decode_and_normalize.py b/examples/pipelines/mnist/implementations/transformers/decode_and_normalize.py similarity index 100% rename from examples/mnist/implementations/transformers/decode_and_normalize.py rename to examples/pipelines/mnist/implementations/transformers/decode_and_normalize.py diff --git a/examples/mnist/requirements.txt b/examples/pipelines/mnist/requirements.txt similarity index 100% rename from examples/mnist/requirements.txt rename to examples/pipelines/mnist/requirements.txt diff --git a/examples/mnist/resources/apis.yaml b/examples/pipelines/mnist/resources/apis.yaml similarity index 100% rename from examples/mnist/resources/apis.yaml rename to examples/pipelines/mnist/resources/apis.yaml diff --git a/examples/mnist/resources/data.yaml b/examples/pipelines/mnist/resources/data.yaml similarity index 100% rename from examples/mnist/resources/data.yaml rename to examples/pipelines/mnist/resources/data.yaml diff --git a/examples/mnist/resources/models.yaml b/examples/pipelines/mnist/resources/models.yaml similarity index 100% rename from examples/mnist/resources/models.yaml rename to examples/pipelines/mnist/resources/models.yaml diff --git a/examples/movie-ratings/cortex.yaml b/examples/pipelines/movie-ratings/cortex.yaml similarity index 100% rename from examples/movie-ratings/cortex.yaml rename to examples/pipelines/movie-ratings/cortex.yaml diff --git a/examples/movie-ratings/implementations/models/basic_embedding.py b/examples/pipelines/movie-ratings/implementations/models/basic_embedding.py similarity index 100% rename from examples/movie-ratings/implementations/models/basic_embedding.py rename to examples/pipelines/movie-ratings/implementations/models/basic_embedding.py diff --git a/examples/movie-ratings/movies.json b/examples/pipelines/movie-ratings/movies.json similarity index 100% rename from examples/movie-ratings/movies.json rename to examples/pipelines/movie-ratings/movies.json diff --git a/examples/movie-ratings/resources/apis.yaml b/examples/pipelines/movie-ratings/resources/apis.yaml similarity index 100% rename from examples/movie-ratings/resources/apis.yaml rename to examples/pipelines/movie-ratings/resources/apis.yaml diff --git a/examples/movie-ratings/resources/data.yaml b/examples/pipelines/movie-ratings/resources/data.yaml similarity index 100% rename from examples/movie-ratings/resources/data.yaml rename to examples/pipelines/movie-ratings/resources/data.yaml diff --git a/examples/movie-ratings/resources/models.yaml b/examples/pipelines/movie-ratings/resources/models.yaml similarity index 100% rename from examples/movie-ratings/resources/models.yaml rename to examples/pipelines/movie-ratings/resources/models.yaml diff --git a/examples/poker/cortex.yaml b/examples/pipelines/poker/cortex.yaml similarity index 100% rename from examples/poker/cortex.yaml rename to examples/pipelines/poker/cortex.yaml diff --git a/examples/poker/hands.json b/examples/pipelines/poker/hands.json similarity index 100% rename from examples/poker/hands.json rename to examples/pipelines/poker/hands.json diff --git a/examples/reviews/cortex.yaml b/examples/pipelines/reviews/cortex.yaml similarity index 100% rename from examples/reviews/cortex.yaml rename to examples/pipelines/reviews/cortex.yaml diff --git a/examples/reviews/implementations/aggregators/max_length.py b/examples/pipelines/reviews/implementations/aggregators/max_length.py similarity index 100% rename from examples/reviews/implementations/aggregators/max_length.py rename to examples/pipelines/reviews/implementations/aggregators/max_length.py diff --git a/examples/reviews/implementations/aggregators/vocab.py b/examples/pipelines/reviews/implementations/aggregators/vocab.py similarity index 100% rename from examples/reviews/implementations/aggregators/vocab.py rename to examples/pipelines/reviews/implementations/aggregators/vocab.py diff --git a/examples/reviews/implementations/models/sentiment_dnn.py b/examples/pipelines/reviews/implementations/models/sentiment_dnn.py similarity index 100% rename from examples/reviews/implementations/models/sentiment_dnn.py rename to examples/pipelines/reviews/implementations/models/sentiment_dnn.py diff --git a/examples/reviews/implementations/models/sentiment_linear.py b/examples/pipelines/reviews/implementations/models/sentiment_linear.py similarity index 100% rename from examples/reviews/implementations/models/sentiment_linear.py rename to examples/pipelines/reviews/implementations/models/sentiment_linear.py diff --git a/examples/reviews/implementations/models/transformer.py b/examples/pipelines/reviews/implementations/models/transformer.py similarity index 100% rename from examples/reviews/implementations/models/transformer.py rename to examples/pipelines/reviews/implementations/models/transformer.py diff --git a/examples/reviews/implementations/transformers/tokenize_string_to_int.py b/examples/pipelines/reviews/implementations/transformers/tokenize_string_to_int.py similarity index 100% rename from examples/reviews/implementations/transformers/tokenize_string_to_int.py rename to examples/pipelines/reviews/implementations/transformers/tokenize_string_to_int.py diff --git a/examples/reviews/requirements.txt b/examples/pipelines/reviews/requirements.txt similarity index 100% rename from examples/reviews/requirements.txt rename to examples/pipelines/reviews/requirements.txt diff --git a/examples/reviews/resources/apis.yaml b/examples/pipelines/reviews/resources/apis.yaml similarity index 100% rename from examples/reviews/resources/apis.yaml rename to examples/pipelines/reviews/resources/apis.yaml diff --git a/examples/reviews/resources/data.yaml b/examples/pipelines/reviews/resources/data.yaml similarity index 100% rename from examples/reviews/resources/data.yaml rename to examples/pipelines/reviews/resources/data.yaml diff --git a/examples/reviews/resources/models.yaml b/examples/pipelines/reviews/resources/models.yaml similarity index 100% rename from examples/reviews/resources/models.yaml rename to examples/pipelines/reviews/resources/models.yaml diff --git a/examples/reviews/reviews.json b/examples/pipelines/reviews/reviews.json similarity index 100% rename from examples/reviews/reviews.json rename to examples/pipelines/reviews/reviews.json diff --git a/examples/wine/cortex.yaml b/examples/pipelines/wine/cortex.yaml similarity index 100% rename from examples/wine/cortex.yaml rename to examples/pipelines/wine/cortex.yaml diff --git a/examples/wine/resources/apis.yaml b/examples/pipelines/wine/resources/apis.yaml similarity index 100% rename from examples/wine/resources/apis.yaml rename to examples/pipelines/wine/resources/apis.yaml diff --git a/examples/wine/resources/data.yaml b/examples/pipelines/wine/resources/data.yaml similarity index 100% rename from examples/wine/resources/data.yaml rename to examples/pipelines/wine/resources/data.yaml diff --git a/examples/wine/resources/models.yaml b/examples/pipelines/wine/resources/models.yaml similarity index 100% rename from examples/wine/resources/models.yaml rename to examples/pipelines/wine/resources/models.yaml diff --git a/examples/wine/resources/normalized_columns.yaml b/examples/pipelines/wine/resources/normalized_columns.yaml similarity index 100% rename from examples/wine/resources/normalized_columns.yaml rename to examples/pipelines/wine/resources/normalized_columns.yaml diff --git a/examples/wine/resources/quality.yaml b/examples/pipelines/wine/resources/quality.yaml similarity index 100% rename from examples/wine/resources/quality.yaml rename to examples/pipelines/wine/resources/quality.yaml diff --git a/examples/wine/wines.json b/examples/pipelines/wine/wines.json similarity index 100% rename from examples/wine/wines.json rename to examples/pipelines/wine/wines.json From a502b2020ebf80f48e18dc04a8a9a4d521fe018c Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 16:07:13 -0700 Subject: [PATCH 08/30] Update docs --- docs/{deployments/resources => apis}/apis.md | 0 .../{deployments/advanced => apis}/compute.md | 0 .../resources => apis}/deployment.md | 0 .../importing-models.md => apis/import.md} | 4 +- .../advanced => apis}/python-packages.md | 0 docs/apis/statuses.md | 18 +++++ docs/{ => apis}/tutorial.md | 4 +- docs/{ => cluster}/development.md | 0 .../resources => pipelines}/aggregates.md | 0 .../aggregators-custom.md} | 0 .../resources => pipelines}/aggregators.md | 0 docs/pipelines/apis.md | 45 +++++++++++++ docs/pipelines/compute.md | 32 +++++++++ .../resources => pipelines}/constants.md | 0 .../resources => pipelines}/data-types.md | 0 docs/pipelines/deployment.md | 17 +++++ .../resources => pipelines}/environments.md | 0 .../estimators-custom.md} | 0 .../resources => pipelines}/estimators.md | 0 .../resources => pipelines}/models.md | 0 .../resources => pipelines}/overview.md | 0 docs/pipelines/python-packages.md | 52 ++++++++++++++ .../resources => pipelines}/raw-columns.md | 0 .../resources => pipelines}/statuses.md | 0 .../advanced => pipelines}/templates.md | 0 .../transformed-columns.md | 0 .../transformers-custom.md} | 0 .../resources => pipelines}/transformers.md | 0 docs/summary.md | 67 +++++++++---------- 29 files changed, 200 insertions(+), 39 deletions(-) rename docs/{deployments/resources => apis}/apis.md (100%) rename docs/{deployments/advanced => apis}/compute.md (100%) rename docs/{deployments/resources => apis}/deployment.md (100%) rename docs/{deployments/advanced/importing-models.md => apis/import.md} (81%) rename docs/{deployments/advanced => apis}/python-packages.md (100%) create mode 100644 docs/apis/statuses.md rename docs/{ => apis}/tutorial.md (95%) rename docs/{ => cluster}/development.md (100%) rename docs/{deployments/resources => pipelines}/aggregates.md (100%) rename docs/{deployments/implementations/aggregators.md => pipelines/aggregators-custom.md} (100%) rename docs/{deployments/resources => pipelines}/aggregators.md (100%) create mode 100644 docs/pipelines/apis.md create mode 100644 docs/pipelines/compute.md rename docs/{deployments/resources => pipelines}/constants.md (100%) rename docs/{deployments/resources => pipelines}/data-types.md (100%) create mode 100644 docs/pipelines/deployment.md rename docs/{deployments/resources => pipelines}/environments.md (100%) rename docs/{deployments/implementations/estimators.md => pipelines/estimators-custom.md} (100%) rename docs/{deployments/resources => pipelines}/estimators.md (100%) rename docs/{deployments/resources => pipelines}/models.md (100%) rename docs/{deployments/resources => pipelines}/overview.md (100%) create mode 100644 docs/pipelines/python-packages.md rename docs/{deployments/resources => pipelines}/raw-columns.md (100%) rename docs/{deployments/resources => pipelines}/statuses.md (100%) rename docs/{deployments/advanced => pipelines}/templates.md (100%) rename docs/{deployments/resources => pipelines}/transformed-columns.md (100%) rename docs/{deployments/implementations/transformers.md => pipelines/transformers-custom.md} (100%) rename docs/{deployments/resources => pipelines}/transformers.md (100%) diff --git a/docs/deployments/resources/apis.md b/docs/apis/apis.md similarity index 100% rename from docs/deployments/resources/apis.md rename to docs/apis/apis.md diff --git a/docs/deployments/advanced/compute.md b/docs/apis/compute.md similarity index 100% rename from docs/deployments/advanced/compute.md rename to docs/apis/compute.md diff --git a/docs/deployments/resources/deployment.md b/docs/apis/deployment.md similarity index 100% rename from docs/deployments/resources/deployment.md rename to docs/apis/deployment.md diff --git a/docs/deployments/advanced/importing-models.md b/docs/apis/import.md similarity index 81% rename from docs/deployments/advanced/importing-models.md rename to docs/apis/import.md index 186348a3a9..bead931377 100644 --- a/docs/deployments/advanced/importing-models.md +++ b/docs/apis/import.md @@ -11,13 +11,13 @@ saved_model.pb variables/ $ zip -r model.zip export/estimator ``` -1. Upload the zipped file to Amazon S3, e.g. +2. Upload the zipped file to Amazon S3, e.g. ```bash $ aws s3 cp model.zip s3://your-bucket/model.zip ``` -1. Specify `model` in an API, e.g. +3. Specify `model` in an API, e.g. ```yaml - kind: api diff --git a/docs/deployments/advanced/python-packages.md b/docs/apis/python-packages.md similarity index 100% rename from docs/deployments/advanced/python-packages.md rename to docs/apis/python-packages.md diff --git a/docs/apis/statuses.md b/docs/apis/statuses.md new file mode 100644 index 0000000000..7bdf12d49a --- /dev/null +++ b/docs/apis/statuses.md @@ -0,0 +1,18 @@ +# Resource Statuses + +## Statuses + +| Status | Meaning | +|----------------------|---| +| ready | API is deployed and ready to serve prediction requests | +| pending | API is waiting for another resource to be ready, or is initializing | +| updating | API is performing a rolling update | +| update pending | API will be updated when the new model is ready; a previous version of this API is ready | +| stopping | API is stopping | +| stopped | API is stopped | +| error | API was not created due to an error; run `cortex logs -v ` to view the logs | +| skipped | API was not created due to an error in another resource | +| update skipped | API was not updated due to an error in another resource; a previous version of this API is ready | +| upstream error | API was not created due to an error in one of its dependencies; a previous version of this API may be ready | +| upstream termination | API was not created because one of its dependencies was terminated; a previous version of this API may be ready | +| compute unavailable | API could not start due to insufficient memory, CPU, or GPU in the cluster; some replicas may be ready | diff --git a/docs/tutorial.md b/docs/apis/tutorial.md similarity index 95% rename from docs/tutorial.md rename to docs/apis/tutorial.md index b1ebee88e3..aa45bcac52 100644 --- a/docs/tutorial.md +++ b/docs/apis/tutorial.md @@ -34,9 +34,7 @@ Add to `cortex.yaml`: - kind: api name: iris-type - model: - path: s3://cortex-examples/iris-tensorflow.zip - region: us-west-2 + model: s3://cortex-examples/iris-tensorflow.zip compute: replicas: 3 ``` diff --git a/docs/development.md b/docs/cluster/development.md similarity index 100% rename from docs/development.md rename to docs/cluster/development.md diff --git a/docs/deployments/resources/aggregates.md b/docs/pipelines/aggregates.md similarity index 100% rename from docs/deployments/resources/aggregates.md rename to docs/pipelines/aggregates.md diff --git a/docs/deployments/implementations/aggregators.md b/docs/pipelines/aggregators-custom.md similarity index 100% rename from docs/deployments/implementations/aggregators.md rename to docs/pipelines/aggregators-custom.md diff --git a/docs/deployments/resources/aggregators.md b/docs/pipelines/aggregators.md similarity index 100% rename from docs/deployments/resources/aggregators.md rename to docs/pipelines/aggregators.md diff --git a/docs/pipelines/apis.md b/docs/pipelines/apis.md new file mode 100644 index 0000000000..709a794371 --- /dev/null +++ b/docs/pipelines/apis.md @@ -0,0 +1,45 @@ +# APIs + +Serve models at scale and use them to build smarter applications. + +## Config + +```yaml +- kind: api + name: # API name (required) + model: # reference to a model (e.g. s3://my-bucket/my-model.zip) + preprocessor: # path to the implementation file, relative to the cortex root (default: .py) + postprocessor: # path to the implementation file, relative to the cortex root (default: .py) + compute: + replicas: # number of replicas to launch (default: 1) + cpu: # CPU request (default: Null) + mem: # memory request (default: Null) + gpu: # gpu request (default: Null) +``` + +## Example + +```yaml +- kind: api + name: my-api + model: s3://my-bucket/my-model.zip + preprocessor: transform_payload.py + postprocessor: process_prediction.py + compute: + replicas: 3 + gpu: 2 +``` + +## Integration + +APIs can be integrated into other applications or services via their JSON endpoints. The endpoint for any API follows the following format: {apis_endpoint}/{deployment_name}/{api_name}. + +The fields in the request payload for a particular API should match the raw columns that were used to train the model that it is serving. Cortex automatically applies the same transformers that were used at training time when responding to prediction requests. + +## Horizontal Scalability + +APIs can be configured using `replicas` in the `compute` field. Replicas can be used to change the amount of computing resources allocated to service prediction requests for a particular API. APIs that have low request volumes should have a small number of replicas while APIs that handle large request volumes should have more replicas. + +## Rolling Updates + +When the model that an API is serving gets updated, Cortex will update the API with the new model without any downtime. diff --git a/docs/pipelines/compute.md b/docs/pipelines/compute.md new file mode 100644 index 0000000000..c331360257 --- /dev/null +++ b/docs/pipelines/compute.md @@ -0,0 +1,32 @@ +# Compute + +Compute resource requests in Cortex follow the syntax and meaning of [compute resources in Kubernetes](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/). + +For example: + +```yaml +- kind: model + ... + compute: + cpu: "2" + mem: "1Gi" + gpu: 1 +``` + +CPU and memory requests in Cortex correspond to compute resource requests in Kubernetes. In the example above, the training job will only be scheduled once 2 CPUs and 1Gi of memory are available, and the job will be guaranteed to have access to those resources throughout it's execution. In some cases, a Cortex compute resource request can be (or may default to) `Null`. + +## CPU + +One unit of CPU corresponds to one virtual CPU on AWS. Fractional requests are allowed, and can be specified as a floating point number or via the "m" suffix (`0.2` and `200m` are equivalent). + +## Memory + +One unit of memory is one byte. Memory can be expressed as an integer or by using one of these suffixes: `K`, `M`, `G`, `T` (or their power-of two counterparts: `Ki`, `Mi`, `Gi`, `Ti`). For example, the following values represent roughly the same memory: `128974848`, `129e6`, `129M`, `123Mi`. + +## GPU + +One unit of GPU corresponds to one virtual GPU on AWS. Fractional requests are not allowed. Here's some information on [adding GPU enabled nodes on EKS](https://docs.aws.amazon.com/en_ca/eks/latest/userguide/gpu-ami.html). + +## GPU Support + +We recommend using GPU compute requests on API resources only if you have enough nodes in your cluster to support the number of GPU requests in model training plus APIs (ideally with an autoscaler). Otherwise, due to the nature of zero downtime rolling updates, your model training will not have sufficient GPU resources as there will always be GPUs consumed by APIs from the previous deployment. diff --git a/docs/deployments/resources/constants.md b/docs/pipelines/constants.md similarity index 100% rename from docs/deployments/resources/constants.md rename to docs/pipelines/constants.md diff --git a/docs/deployments/resources/data-types.md b/docs/pipelines/data-types.md similarity index 100% rename from docs/deployments/resources/data-types.md rename to docs/pipelines/data-types.md diff --git a/docs/pipelines/deployment.md b/docs/pipelines/deployment.md new file mode 100644 index 0000000000..8aae97e242 --- /dev/null +++ b/docs/pipelines/deployment.md @@ -0,0 +1,17 @@ +# Deployment + +The deployment resource is used to group a set of resources that can be deployed as a singular unit. It must be defined in every Cortex directory in a top-level `cortex.yaml` file. + +## Config + +```yaml +- kind: deployment + name: # deployment name (required) +``` + +## Example + +```yaml +- kind: deployment + name: my_deployment +``` diff --git a/docs/deployments/resources/environments.md b/docs/pipelines/environments.md similarity index 100% rename from docs/deployments/resources/environments.md rename to docs/pipelines/environments.md diff --git a/docs/deployments/implementations/estimators.md b/docs/pipelines/estimators-custom.md similarity index 100% rename from docs/deployments/implementations/estimators.md rename to docs/pipelines/estimators-custom.md diff --git a/docs/deployments/resources/estimators.md b/docs/pipelines/estimators.md similarity index 100% rename from docs/deployments/resources/estimators.md rename to docs/pipelines/estimators.md diff --git a/docs/deployments/resources/models.md b/docs/pipelines/models.md similarity index 100% rename from docs/deployments/resources/models.md rename to docs/pipelines/models.md diff --git a/docs/deployments/resources/overview.md b/docs/pipelines/overview.md similarity index 100% rename from docs/deployments/resources/overview.md rename to docs/pipelines/overview.md diff --git a/docs/pipelines/python-packages.md b/docs/pipelines/python-packages.md new file mode 100644 index 0000000000..b5a6d336be --- /dev/null +++ b/docs/pipelines/python-packages.md @@ -0,0 +1,52 @@ +# Python Packages + +Cortex allows you to install additional Python packages that can be made available to aggregators, transformers, and estimators. + +## PyPI Packages + +Cortex looks for a `requirements.txt` file in the top level cortex directory (in the same level as `cortex.yaml`). All packages listed in `requirements.txt` will be made available to aggregators, transformers, and estimators. + +```text +./iris/ +├── cortex.yaml +├── requirements.txt +├── samples.json +├── implementations/ +└── resources/ +``` + +## Custom Packages + +Cortex looks for your Python packages in the directory `./packages/`. The package must have a `setup.py` in the root of the package directory with the name set to your package name. Cortex will run `pip3 wheel -w wheelhouse ./packages/` to construct wheels for the Python Project. + +Cortex Directory + +```text +./iris/ +├── cortex.yaml +├── samples.json +├── implementations/ +├── resources/ +└── packages + └── acme-util + ├── acme-util/ + | ├── util_a.py + | └── util_b.py + └── setup.py +``` + +Sample `setup.py` + +```python +from distutils.core import setup + +setup( + name="acme-util", + version="0.0.1", + description="", + author="ACME C. M. Exists", + author_email="acme@acme.com", + packages=["acme-util"], + install_requires=["pyyaml==3.13"], +) +``` diff --git a/docs/deployments/resources/raw-columns.md b/docs/pipelines/raw-columns.md similarity index 100% rename from docs/deployments/resources/raw-columns.md rename to docs/pipelines/raw-columns.md diff --git a/docs/deployments/resources/statuses.md b/docs/pipelines/statuses.md similarity index 100% rename from docs/deployments/resources/statuses.md rename to docs/pipelines/statuses.md diff --git a/docs/deployments/advanced/templates.md b/docs/pipelines/templates.md similarity index 100% rename from docs/deployments/advanced/templates.md rename to docs/pipelines/templates.md diff --git a/docs/deployments/resources/transformed-columns.md b/docs/pipelines/transformed-columns.md similarity index 100% rename from docs/deployments/resources/transformed-columns.md rename to docs/pipelines/transformed-columns.md diff --git a/docs/deployments/implementations/transformers.md b/docs/pipelines/transformers-custom.md similarity index 100% rename from docs/deployments/implementations/transformers.md rename to docs/pipelines/transformers-custom.md diff --git a/docs/deployments/resources/transformers.md b/docs/pipelines/transformers.md similarity index 100% rename from docs/deployments/resources/transformers.md rename to docs/pipelines/transformers.md diff --git a/docs/summary.md b/docs/summary.md index 4d8bc56b12..788551eca1 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -2,48 +2,47 @@ * [README](../README.md) * [Install](cluster/install.md) -* [Tutorial](tutorial.md) +* [Tutorial](apis/tutorial.md) * [Examples](https://github.com/cortexlabs/cortex/tree/master/examples) -## Model Deployment +## Model Deployments -* [Deployments](deployments/resources/deployment.md) -* [APIs](deployments/resources/apis.md) -* [Importing Models](deployments/advanced/importing-models.md) -* [Compute](deployments/advanced/compute.md) +* [Deployments](apis/deployment.md) +* [APIs](apis/apis.md) +* [Importing Models](apis/import.md) +* [Python Packages](apis/python-packages.md) +* [Compute](apis/compute.md) * [CLI Commands](cluster/cli.md) - -## Pipeline Deployment - -* [Pipeline Overview](deployments/resources/overview.md) -* [Deployments](deployments/resources/deployment.md) -* [Environments](deployments/resources/environments.md) -* [Raw Columns](deployments/resources/raw-columns.md) -* [Aggregators](deployments/resources/aggregators.md) -* [Custom Aggregators](deployments/implementations/aggregators.md) -* [Aggregates](deployments/resources/aggregates.md) -* [Transformers](deployments/resources/transformers.md) -* [Custom Transformers](deployments/implementations/transformers.md) -* [Transformed Columns](deployments/resources/transformed-columns.md) -* [Estimators](deployments/resources/estimators.md) -* [Custom Estimators](deployments/implementations/estimators.md) -* [Models](deployments/resources/models.md) -* [APIs](deployments/resources/apis.md) -* [Constants](deployments/resources/constants.md) -* [Data Types](deployments/resources/data-types.md) -* [Resource Statuses](deployments/resources/statuses.md) -* [CLI Commands](cluster/cli.md) - -## Advanced - -* [Templates](deployments/advanced/templates.md) -* [Compute](deployments/advanced/compute.md) -* [Python Packages](deployments/advanced/python-packages.md) +* [Resource Statuses](apis/statuses.md) ## Cluster -* [Development](development.md) * [AWS Credentials](cluster/aws.md) * [Config](cluster/config.md) * [Security](cluster/security.md) * [Uninstall](cluster/uninstall.md) +* [Development](development.md) + +## Pipeline Deployments + +* [Pipeline Overview](pipelines/overview.md) +* [Deployments](pipelines/deployment.md) +* [Environments](pipelines/environments.md) +* [Raw Columns](pipelines/raw-columns.md) +* [Aggregators](pipelines/aggregators.md) +* [Custom Aggregators](pipelines/implementations/aggregators.md) +* [Aggregates](pipelines/aggregates.md) +* [Transformers](pipelines/transformers.md) +* [Custom Transformers](pipelines/implementations/transformers.md) +* [Transformed Columns](pipelines/transformed-columns.md) +* [Estimators](pipelines/estimators.md) +* [Custom Estimators](pipelines/implementations/estimators.md) +* [Models](pipelines/pipelines.md) +* [APIs](pipelines/apis.md) +* [Constants](pipelines/constants.md) +* [Data Types](pipelines/data-types.md) +* [Templates](pipelines/templates.md) +* [Compute](pipelines/compute.md) +* [Python Packages](pipelines/python-packages.md) +* [CLI Commands](cluster/cli.md) +* [Resource Statuses](pipelines/statuses.md) From f865cb1c83a37f960a8ee115f7b70911daa9d813 Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 16:11:52 -0700 Subject: [PATCH 09/30] Update docs --- docs/pipelines/overview.md | 14 +------------- docs/summary.md | 6 +++--- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/docs/pipelines/overview.md b/docs/pipelines/overview.md index bf6d51d710..1a93950f16 100644 --- a/docs/pipelines/overview.md +++ b/docs/pipelines/overview.md @@ -1,18 +1,6 @@ # Overview -Cortex deployments consist of declarative resource configuration written in YAML as well as Python code to implement aggregators, transformers, and models. Each resource has a `kind`: - -* [deployment](deployment.md) -* [environment](environments.md) -* [raw_column](raw-columns.md) -* [aggregator](aggregators.md) -* [aggregate](aggregates.md) -* [transformer](transformers.md) -* [transformed_column](transformed-columns.md) -* [estimator](estimators.md) -* [model](models.md) -* [api](apis.md) -* [constant](constants.md) +Cortex deployments consist of declarative resource configuration written in YAML as well as Python code to implement aggregators, transformers, and models. Each resource has a `kind`. Resources can reference other resources from within their configuration (e.g. when defining input values) by prefixing the other resource's name with an `@` symbol. For example, a model may specify `input: @column1`, which denotes that a resource named "column1" is an input to this model. diff --git a/docs/summary.md b/docs/summary.md index 788551eca1..a0893e54e1 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -21,11 +21,11 @@ * [Config](cluster/config.md) * [Security](cluster/security.md) * [Uninstall](cluster/uninstall.md) -* [Development](development.md) +* [Development](cluster/development.md) ## Pipeline Deployments -* [Pipeline Overview](pipelines/overview.md) +* [Overview](pipelines/overview.md) * [Deployments](pipelines/deployment.md) * [Environments](pipelines/environments.md) * [Raw Columns](pipelines/raw-columns.md) @@ -42,7 +42,7 @@ * [Constants](pipelines/constants.md) * [Data Types](pipelines/data-types.md) * [Templates](pipelines/templates.md) -* [Compute](pipelines/compute.md) * [Python Packages](pipelines/python-packages.md) +* [Compute](pipelines/compute.md) * [CLI Commands](cluster/cli.md) * [Resource Statuses](pipelines/statuses.md) From 8e36687ea40d849106f7c185c92a243c5481b19f Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 16:40:06 -0700 Subject: [PATCH 10/30] Update cli.md --- docs/cluster/cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cluster/cli.md b/docs/cluster/cli.md index 2804610cc9..a4716865bd 100644 --- a/docs/cluster/cli.md +++ b/docs/cluster/cli.md @@ -54,7 +54,7 @@ Delete a deployment. Usage: cortex delete [DEPLOYMENT_NAME] [flags] -Flags: +Flags: -c, --keep-cache keep cached data for the deployment -h, --help ``` From 0a242b62e6ccc28558d6c1300eabc050ab02d645 Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 17:24:49 -0700 Subject: [PATCH 11/30] Update README.md --- README.md | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index ee290b27b4..b1aab24917 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,15 @@
-## Deployment platform for machine learning in production - -Cortex deploys your machine learning models on your cloud infrastructure. You define your deployment with simple declarative configuration, Cortex containerizes your models, deploys them as scalable JSON APIs, and manages their lifecycle in production. +Cortex deploys your machine learning models to your cloud infrastructure. You define your deployment with simple declarative configuration, Cortex containerizes your models, deploys them as scalable JSON APIs, and manages their lifecycle in production. Cortex is actively maintained by Cortex Labs. We're a venture-backed team of infrastructure engineers and [we're hiring](https://angel.co/cortex-labs-inc/jobs).
-## Machine learning deployments as code +## How it works -**Define** your deployment using declarative configuration. +**Define** your deployment using declarative configuration: ```yaml - kind: api @@ -31,41 +29,33 @@ Cortex is actively maintained by Cortex Labs. We're a venture-backed team of inf gpu: 2 ``` -**Deploy** to your cloud infrastructure. +**Deploy** to your cloud infrastructure: ``` $ cortex deploy -Provisioning infrastructure ... -Deploying API ... -Loading model ... - +Deploying ... Ready! https://amazonaws.com/my-api ``` -**Serve** real time predictions via scalable JSON APIs. +**Serve** real time predictions via scalable JSON APIs: ``` -$ cortex status my-api +$ cortex predict my-api my-samples.json -Endpoint: https://amazonaws.com/my-api -Latency: 200ms -Throughput: 50 requests per second -Predictions: 1,234,567 legitimate | 89 fraud +TODO ```
## Key features -- **Machine learning deployments as code:** Cortex deployments are defined using a simple declarative syntax that enables flexibility and reusability. +- **Machine learning deployments as code:** Cortex deployments are defined using a simple declarative syntax TODO. -- **Multi framework support:** Cortex supports [TensorFlow](https://www.tensorflow.org), [Keras](https://keras.io), and [PyTorch](https://pytorch.org) models. +- **Multi framework support:** Cortex supports [TensorFlow](https://www.tensorflow.org) models with more frameworks coming soon. -- **Scalability:** Cortex automatically handles scaling APIs. +- **Scalability:** Cortex can scale APIs to handle production workloads. - **Rolling updates:** Cortex updates deployed APIs without any downtime. -- **A/B testing:** Cortex can load balance traffic across multiple models. - -- **Cloud agnostic:** Cortex can handle production workloads and can be deployed on any Kubernetes cluster in minutes. +- **Cloud agnostic:** Cortex can be deployed on any AWS account in minutes. From 0c859e912dba0c026d62820747037a3ef58bf6fb Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 18:17:39 -0700 Subject: [PATCH 12/30] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b1aab24917..3ea6940c41 100644 --- a/README.md +++ b/README.md @@ -41,16 +41,16 @@ Ready! https://amazonaws.com/my-api **Serve** real time predictions via scalable JSON APIs: ``` -$ cortex predict my-api my-samples.json +$ curl https://amazonaws.com/my-api -TODO +{ prediction: ABC } ```
## Key features -- **Machine learning deployments as code:** Cortex deployments are defined using a simple declarative syntax TODO. +- **Machine learning deployments as code:** Cortex deployments are defined using a simple declarative syntax. - **Multi framework support:** Cortex supports [TensorFlow](https://www.tensorflow.org) models with more frameworks coming soon. From 79bade7dbcd879819b96a3bb7578f706719f83da Mon Sep 17 00:00:00 2001 From: Omer Spillinger Date: Mon, 24 Jun 2019 18:19:01 -0700 Subject: [PATCH 13/30] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3ea6940c41..2b4579a036 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Ready! https://amazonaws.com/my-api ``` $ curl https://amazonaws.com/my-api -{ prediction: ABC } +{ prediction: 123 } ```
@@ -52,7 +52,7 @@ $ curl https://amazonaws.com/my-api - **Machine learning deployments as code:** Cortex deployments are defined using a simple declarative syntax. -- **Multi framework support:** Cortex supports [TensorFlow](https://www.tensorflow.org) models with more frameworks coming soon. +- **Multi framework support:** Cortex supports TensorFlow models with more frameworks coming soon. - **Scalability:** Cortex can scale APIs to handle production workloads. From a5a1ca12ddda9dfb8cc22266733ccfbb48ea3502 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 11:48:37 -0700 Subject: [PATCH 14/30] Update iris examples --- examples/iris/cortex.yaml | 4 +++- examples/pipelines/iris/cortex.yaml | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/iris/cortex.yaml b/examples/iris/cortex.yaml index 927787f689..c4ed4f56d6 100644 --- a/examples/iris/cortex.yaml +++ b/examples/iris/cortex.yaml @@ -3,6 +3,8 @@ - kind: api name: iris-type - model: s3://cortex-examples/iris-model.zip + external_model: + path: s3://cortex-examples/iris-model.zip + region: us-west-2 compute: replicas: 3 diff --git a/examples/pipelines/iris/cortex.yaml b/examples/pipelines/iris/cortex.yaml index 34ff5d2fad..6e253d9149 100644 --- a/examples/pipelines/iris/cortex.yaml +++ b/examples/pipelines/iris/cortex.yaml @@ -1,5 +1,5 @@ -- kind: app - name: iris +- kind: deployment + name: iris-e2e - kind: environment name: dev From d241a17875a4ac46e58fb8543f9d9aa1977ae117 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 12:28:14 -0700 Subject: [PATCH 15/30] Update docs --- docs/apis/apis.md | 10 ++++++---- docs/pipelines/apis.md | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/apis/apis.md b/docs/apis/apis.md index 709a794371..4a07f4a5fb 100644 --- a/docs/apis/apis.md +++ b/docs/apis/apis.md @@ -7,14 +7,16 @@ Serve models at scale and use them to build smarter applications. ```yaml - kind: api name: # API name (required) - model: # reference to a model (e.g. s3://my-bucket/my-model.zip) + external_model: + path: # path to a zipped model dir (e.g. s3://my-bucket/model.zip) + region: # S3 region (default: us-west-2) preprocessor: # path to the implementation file, relative to the cortex root (default: .py) postprocessor: # path to the implementation file, relative to the cortex root (default: .py) compute: replicas: # number of replicas to launch (default: 1) - cpu: # CPU request (default: Null) - mem: # memory request (default: Null) - gpu: # gpu request (default: Null) + cpu: # CPU request per replica (default: Null) + gpu: # gpu request per replica (default: Null) + mem: # memory request per replica (default: Null) ``` ## Example diff --git a/docs/pipelines/apis.md b/docs/pipelines/apis.md index 709a794371..a3687b3bd1 100644 --- a/docs/pipelines/apis.md +++ b/docs/pipelines/apis.md @@ -7,14 +7,17 @@ Serve models at scale and use them to build smarter applications. ```yaml - kind: api name: # API name (required) - model: # reference to a model (e.g. s3://my-bucket/my-model.zip) + model: # reference to a model (e.g. @dnn) (this or external_model must be specified) + external_model: # (this or model must be specified) + path: # path to a zipped model dir (e.g. s3://my-bucket/model.zip) + region: # S3 region (default: us-west-2) preprocessor: # path to the implementation file, relative to the cortex root (default: .py) postprocessor: # path to the implementation file, relative to the cortex root (default: .py) compute: replicas: # number of replicas to launch (default: 1) - cpu: # CPU request (default: Null) - mem: # memory request (default: Null) - gpu: # gpu request (default: Null) + cpu: # CPU request per replica (default: Null) + gpu: # gpu request per replica (default: Null) + mem: # memory request per replica (default: Null) ``` ## Example From 1d43535800add220341aba524b548e9b2982ccb7 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 12:48:11 -0700 Subject: [PATCH 16/30] Update docs --- README.md | 12 ++++++------ docs/apis/apis.md | 8 +++----- docs/apis/import.md | 4 +++- docs/apis/tutorial.md | 4 +++- docs/pipelines/apis.md | 6 +----- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 2b4579a036..81c57e55c8 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ Cortex is actively maintained by Cortex Labs. We're a venture-backed team of inf ```yaml - kind: api name: my-api - model: s3://my-bucket/my-model.zip # TensorFlow / PyTorch - preprocessor: transform_payload.py # Transform request payloads before inference - postprocessor: process_prediction.py # Transform predicitons before responding to the client + external_model: + path: s3://my-bucket/my-model.zip + region: us-west-2 compute: replicas: 3 gpu: 2 @@ -41,9 +41,9 @@ Ready! https://amazonaws.com/my-api **Serve** real time predictions via scalable JSON APIs: ``` -$ curl https://amazonaws.com/my-api +$ curl -d '{"a": 1, "b": 2, "c": 3}' https://amazonaws.com/my-api -{ prediction: 123 } +{ prediction: "def" } ```
@@ -58,4 +58,4 @@ $ curl https://amazonaws.com/my-api - **Rolling updates:** Cortex updates deployed APIs without any downtime. -- **Cloud agnostic:** Cortex can be deployed on any AWS account in minutes. +- **Cloud native:** Cortex can be deployed on any AWS account in minutes. diff --git a/docs/apis/apis.md b/docs/apis/apis.md index 4a07f4a5fb..4f1b32b9ec 100644 --- a/docs/apis/apis.md +++ b/docs/apis/apis.md @@ -10,8 +10,6 @@ Serve models at scale and use them to build smarter applications. external_model: path: # path to a zipped model dir (e.g. s3://my-bucket/model.zip) region: # S3 region (default: us-west-2) - preprocessor: # path to the implementation file, relative to the cortex root (default: .py) - postprocessor: # path to the implementation file, relative to the cortex root (default: .py) compute: replicas: # number of replicas to launch (default: 1) cpu: # CPU request per replica (default: Null) @@ -24,9 +22,9 @@ Serve models at scale and use them to build smarter applications. ```yaml - kind: api name: my-api - model: s3://my-bucket/my-model.zip - preprocessor: transform_payload.py - postprocessor: process_prediction.py + external_model: + path: s3://my-bucket/my-model.zip + region: us-west-2 compute: replicas: 3 gpu: 2 diff --git a/docs/apis/import.md b/docs/apis/import.md index bead931377..e14ce41f3a 100644 --- a/docs/apis/import.md +++ b/docs/apis/import.md @@ -22,5 +22,7 @@ $ aws s3 cp model.zip s3://your-bucket/model.zip ```yaml - kind: api name: my-api - model: s3://my-bucket/model.zip + external_model: + path: s3://my-bucket/my-model.zip + region: us-west-2 ``` diff --git a/docs/apis/tutorial.md b/docs/apis/tutorial.md index aa45bcac52..aaa18605ca 100644 --- a/docs/apis/tutorial.md +++ b/docs/apis/tutorial.md @@ -34,7 +34,9 @@ Add to `cortex.yaml`: - kind: api name: iris-type - model: s3://cortex-examples/iris-tensorflow.zip + external_model: + path: s3://cortex-examples/iris-tensorflow.zip + region: us-west-2 compute: replicas: 3 ``` diff --git a/docs/pipelines/apis.md b/docs/pipelines/apis.md index a3687b3bd1..97efc6e491 100644 --- a/docs/pipelines/apis.md +++ b/docs/pipelines/apis.md @@ -11,8 +11,6 @@ Serve models at scale and use them to build smarter applications. external_model: # (this or model must be specified) path: # path to a zipped model dir (e.g. s3://my-bucket/model.zip) region: # S3 region (default: us-west-2) - preprocessor: # path to the implementation file, relative to the cortex root (default: .py) - postprocessor: # path to the implementation file, relative to the cortex root (default: .py) compute: replicas: # number of replicas to launch (default: 1) cpu: # CPU request per replica (default: Null) @@ -25,9 +23,7 @@ Serve models at scale and use them to build smarter applications. ```yaml - kind: api name: my-api - model: s3://my-bucket/my-model.zip - preprocessor: transform_payload.py - postprocessor: process_prediction.py + model: @dnn compute: replicas: 3 gpu: 2 From 528a893b07beb0a470a0d22029152d57acfb5ba6 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 12:53:21 -0700 Subject: [PATCH 17/30] Update import.md --- docs/apis/import.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/apis/import.md b/docs/apis/import.md index e14ce41f3a..17bfdebe85 100644 --- a/docs/apis/import.md +++ b/docs/apis/import.md @@ -2,27 +2,27 @@ ## TensorFlow -1. Zip the exported estimator output in your checkpoint directory, e.g. +Zip the exported estimator output in your checkpoint directory, e.g. -```bash +```text $ ls export/estimator saved_model.pb variables/ $ zip -r model.zip export/estimator ``` -2. Upload the zipped file to Amazon S3, e.g. +Upload the zipped file to Amazon S3, e.g. -```bash -$ aws s3 cp model.zip s3://your-bucket/model.zip +```text +$ aws s3 cp model.zip s3://my-bucket/model.zip ``` -3. Specify `model` in an API, e.g. +Specify `model` in an API, e.g. ```yaml - kind: api name: my-api external_model: - path: s3://my-bucket/my-model.zip + path: s3://my-bucket/model.zip region: us-west-2 ``` From 20a6ccbb2a56170c2f1209df32bdb6bffd0d08a9 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 13:03:56 -0700 Subject: [PATCH 18/30] Update docs --- docs/apis/{import.md => packaging-models.md} | 4 +-- docs/pipelines/packaging-models.md | 28 ++++++++++++++++++++ docs/summary.md | 3 ++- 3 files changed, 32 insertions(+), 3 deletions(-) rename docs/apis/{import.md => packaging-models.md} (87%) create mode 100644 docs/pipelines/packaging-models.md diff --git a/docs/apis/import.md b/docs/apis/packaging-models.md similarity index 87% rename from docs/apis/import.md rename to docs/apis/packaging-models.md index 17bfdebe85..5d2c2deb00 100644 --- a/docs/apis/import.md +++ b/docs/apis/packaging-models.md @@ -1,4 +1,4 @@ -# Importing Models +# Packaging Models ## TensorFlow @@ -17,7 +17,7 @@ Upload the zipped file to Amazon S3, e.g. $ aws s3 cp model.zip s3://my-bucket/model.zip ``` -Specify `model` in an API, e.g. +Specify `external_model` in an API, e.g. ```yaml - kind: api diff --git a/docs/pipelines/packaging-models.md b/docs/pipelines/packaging-models.md new file mode 100644 index 0000000000..5d2c2deb00 --- /dev/null +++ b/docs/pipelines/packaging-models.md @@ -0,0 +1,28 @@ +# Packaging Models + +## TensorFlow + +Zip the exported estimator output in your checkpoint directory, e.g. + +```text +$ ls export/estimator +saved_model.pb variables/ + +$ zip -r model.zip export/estimator +``` + +Upload the zipped file to Amazon S3, e.g. + +```text +$ aws s3 cp model.zip s3://my-bucket/model.zip +``` + +Specify `external_model` in an API, e.g. + +```yaml +- kind: api + name: my-api + external_model: + path: s3://my-bucket/model.zip + region: us-west-2 +``` diff --git a/docs/summary.md b/docs/summary.md index a0893e54e1..9d798018c4 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -9,7 +9,7 @@ * [Deployments](apis/deployment.md) * [APIs](apis/apis.md) -* [Importing Models](apis/import.md) +* [Packaging Models](apis/packaging-models.md) * [Python Packages](apis/python-packages.md) * [Compute](apis/compute.md) * [CLI Commands](cluster/cli.md) @@ -42,6 +42,7 @@ * [Constants](pipelines/constants.md) * [Data Types](pipelines/data-types.md) * [Templates](pipelines/templates.md) +* [Packaging Models](pipelines/packaging-models.md) * [Python Packages](pipelines/python-packages.md) * [Compute](pipelines/compute.md) * [CLI Commands](cluster/cli.md) From 94f41a09b2e14fbfbaaeccd74705553514b29d5e Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 13:35:24 -0700 Subject: [PATCH 19/30] Update cli.md --- docs/cluster/cli.md | 55 ++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/docs/cluster/cli.md b/docs/cluster/cli.md index a4716865bd..e287771ecb 100644 --- a/docs/cluster/cli.md +++ b/docs/cluster/cli.md @@ -2,37 +2,39 @@ ## deploy -``` +```text Create or update a deployment. Usage: cortex deploy [flags] Flags: - -f, --force - -h, --help + -e, --env string environment (default "dev") + -f, --force stop all running jobs + -h, --help help for deploy ``` -The `deploy` command sends all deployment configuration and code to Cortex. If all validations pass, Cortex will attempt to create the desired state on the cluster. +The `deploy` command sends all deployment configuration and code to Cortex. If validations pass, Cortex will attempt to create the desired state on the cluster. ## refresh -``` +```text Delete cached resources and deploy. Usage: cortex refresh [flags] Flags: - -f, --force - -h, --help + -e, --env string environment (default "dev") + -f, --force stop all running jobs + -h, --help help for refresh ``` The `refresh` command behaves similarly to the `deploy` command. The key difference is that `refresh` doesn't use any cached resources. ## predict -``` +```text Make predictions. Usage: @@ -40,30 +42,32 @@ Usage: Flags: -d, --deployment string deployment name + -e, --env string environment (default "dev") + -h, --help help for predict -j, --json print the raw json response - -h, --help ``` -The `predict` command converts samples from a JSON file into prediction requests and outputs the response. This command is useful for quickly testing model output. +The `predict` command converts samples from a JSON file into prediction requests and displays the response. This command is useful for quickly testing model output. ## delete -``` +```text Delete a deployment. Usage: cortex delete [DEPLOYMENT_NAME] [flags] Flags: + -e, --env string environment (default "dev") + -h, --help help for delete -c, --keep-cache keep cached data for the deployment - -h, --help ``` The `delete` command deletes an deployment's resources from the cluster. ## get -``` +```text Get information about resources. Usage: @@ -71,16 +75,17 @@ Usage: Flags: -d, --deployment string deployment name - -s, --summary summarized view of resources + -e, --env string environment (default "dev") + -h, --help help for get + -s, --summary show summarized output -w, --watch re-run the command every 2 seconds - -h, --help ``` -The `get` command outputs the current state of all resources on the cluster. Specifying a resource name provides a more detailed view of the configuration and state of that particular resource. +The `get` command displays the current state of all resources on the cluster. Specifying a resource name provides a more detailed view of the configuration and state of that particular resource. Using the `-s` or `--summary` flag will show a summarized view of all resource statuses. ## logs -``` +```text Get logs for a resource. Usage: @@ -88,31 +93,31 @@ Usage: Flags: -d, --deployment string deployment name - -v, --verbose - -h, --help + -e, --env string environment (default "dev") + -h, --help help for logs + -v, --verbose show verbose output ``` The `logs` command streams logs from the workload corresponding to the specified resource. For example, `cortex logs models dnn` will get the Cortex logs from the most recent training workload for `dnn`. Using the `-v` or `--verbose` flag will show all of the logs for the workload (not just Cortex's logs). ## configure -``` +```text Configure the CLI. Usage: cortex configure [flags] Flags: - -h, --help + -e, --env string environment (default "dev") + -h, --help help for configure ``` -The `configure` command is used to connect to the Cortex cluster. The CLI needs a Cortex operator URL as well as valid AWS credentials in order to authenticate requests. - -The CLI stores this information in the `~/.cortex` directory. +The `configure` command is used to connect to the Cortex cluster. The CLI needs a Cortex operator URL as well as valid AWS credentials in order to authenticate requests. The CLI stores this information in the `~/.cortex` directory. ## completion -``` +```text Generate bash completion scripts. Add this to your bashrc or bash profile: From 3ddbdfb0e6458c4268c982e18a03c0f36f5e105a Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 13:43:03 -0700 Subject: [PATCH 20/30] Hide resource types from CLI help --- cli/cmd/get.go | 2 +- cli/cmd/logs.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cmd/get.go b/cli/cmd/get.go index c9cc65a29c..06a9924bdf 100644 --- a/cli/cmd/get.go +++ b/cli/cmd/get.go @@ -42,7 +42,7 @@ func init() { addEnvFlag(getCmd) addWatchFlag(getCmd) addSummaryFlag(getCmd) - addResourceTypesToHelp(getCmd) + // addResourceTypesToHelp(getCmd) } var getCmd = &cobra.Command{ diff --git a/cli/cmd/logs.go b/cli/cmd/logs.go index 4b340fb342..0743033db0 100644 --- a/cli/cmd/logs.go +++ b/cli/cmd/logs.go @@ -27,7 +27,7 @@ func init() { addAppNameFlag(logsCmd) addEnvFlag(logsCmd) addVerboseFlag(logsCmd) - addResourceTypesToHelp(logsCmd) + // addResourceTypesToHelp(logsCmd) } var logsCmd = &cobra.Command{ From dfaf564782a2dc86c409f5763c1ff5e9344f4d6d Mon Sep 17 00:00:00 2001 From: Omer Spillinger <42219498+ospillinger@users.noreply.github.com> Date: Tue, 25 Jun 2019 14:02:41 -0700 Subject: [PATCH 21/30] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 81c57e55c8..1acc7d7e1c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
-**Get started:** [Install](https://docs.cortex.dev/install) • [Tutorial](https://docs.cortex.dev/tutorial) • [Demo Video](https://www.youtube.com/watch?v=tgMjCOD_ufo) • [Docs](https://docs.cortex.dev) • [Examples](https://github.com/cortexlabs/cortex/tree/0.4/examples) +**Get started:** [Install](https://docs.cortex.dev/install) • [Tutorial](https://docs.cortex.dev/tutorial) • [Docs](https://docs.cortex.dev) • [Examples](https://github.com/cortexlabs/cortex/tree/0.4/examples) **Learn more:** [Website](https://cortex.dev) • [Blog](https://blog.cortex.dev) • [Subscribe](https://cortexlabs.us20.list-manage.com/subscribe?u=a1987373ab814f20961fd90b4&id=ae83491e1c) • [Twitter](https://twitter.com/cortex_deploy) • [Contact](mailto:hello@cortex.dev) @@ -50,10 +50,12 @@ $ curl -d '{"a": 1, "b": 2, "c": 3}' https://amazonaws.com/my-api ## Key features -- **Machine learning deployments as code:** Cortex deployments are defined using a simple declarative syntax. +- **Machine learning deployments as code:** Cortex deployments are defined using declarative configuration. - **Multi framework support:** Cortex supports TensorFlow models with more frameworks coming soon. +- **CPU / GPU support:** Cortex can run inference on CPU or GPU infrastructure. + - **Scalability:** Cortex can scale APIs to handle production workloads. - **Rolling updates:** Cortex updates deployed APIs without any downtime. From 52144fa6c211bb2d08810c24f10f2c919d6c2123 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 14:02:46 -0700 Subject: [PATCH 22/30] Update docs --- docs/apis/tutorial.md | 14 +++++++------- docs/cluster/install.md | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/apis/tutorial.md b/docs/apis/tutorial.md index aaa18605ca..aabf7ff704 100644 --- a/docs/apis/tutorial.md +++ b/docs/apis/tutorial.md @@ -2,7 +2,7 @@ ## Prerequisites -1. A Kubernetes cluster running Cortex ([installation instructions](operator/install.md)) +1. A Kubernetes cluster running Cortex ([installation instructions](cluster/install.md)) 2. The Cortex CLI ## Deployment @@ -43,13 +43,13 @@ Add to `cortex.yaml`: ### Deploy the API -``` +```text $ cortex deploy ``` You can get a summary of the status of resources using `cortex get`: -``` +```text $ cortex get --watch ``` @@ -72,7 +72,7 @@ Define a sample in `irises.json`: When the API is ready, request a prediction from the API: -``` +```text $ cortex predict iris-type irises.json ``` @@ -80,13 +80,13 @@ $ cortex predict iris-type irises.json Get the API's endpoint: -``` +```text $ cortex get iris-type ``` Use cURL to test the API: -``` +```text $ curl -k -X POST -H "Content-Type: application/json" \ -d '{ "samples": [ { "sepal_length": 5.2, "sepal_width": 3.6, "petal_length": 1.4, "petal_width": 0.3 } ] }' \ @@ -96,7 +96,7 @@ $ curl -k -X POST -H "Content-Type: application/json" \ Delete the deployment: -``` +```text $ cortex delete iris ``` diff --git a/docs/cluster/install.md b/docs/cluster/install.md index 7d8531afa7..20ed12f141 100644 --- a/docs/cluster/install.md +++ b/docs/cluster/install.md @@ -71,11 +71,11 @@ git clone -b master https://github.com/cortexlabs/cortex.git # Navigate to the iris classification example cd cortex/examples/iris -# Deploy the application to the cluster +# Deploy the model to the cluster cortex deploy # View the status of the deployment -cortex status --watch +cortex get --watch # Classify a sample cortex predict iris-type irises.json From eb2e6a9b92e739be258eb10155a8462c99a2d28d Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 14:07:09 -0700 Subject: [PATCH 23/30] Update docs --- docs/apis/tutorial.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/apis/tutorial.md b/docs/apis/tutorial.md index aabf7ff704..4997b09967 100644 --- a/docs/apis/tutorial.md +++ b/docs/apis/tutorial.md @@ -2,14 +2,14 @@ ## Prerequisites -1. A Kubernetes cluster running Cortex ([installation instructions](cluster/install.md)) +1. A Kubernetes cluster running Cortex ([installation instructions](../cluster/install.md)) 2. The Cortex CLI ## Deployment ### cortex.yaml -```bash +```text $ mkdir iris && cd iris $ touch cortex.yaml irises.json ``` From 30dcda3726c2a538deace3e33e8b441720ce7d27 Mon Sep 17 00:00:00 2001 From: Omer Spillinger <42219498+ospillinger@users.noreply.github.com> Date: Tue, 25 Jun 2019 14:07:20 -0700 Subject: [PATCH 24/30] Delete python-packages.md --- docs/apis/python-packages.md | 52 ------------------------------------ 1 file changed, 52 deletions(-) delete mode 100644 docs/apis/python-packages.md diff --git a/docs/apis/python-packages.md b/docs/apis/python-packages.md deleted file mode 100644 index b5a6d336be..0000000000 --- a/docs/apis/python-packages.md +++ /dev/null @@ -1,52 +0,0 @@ -# Python Packages - -Cortex allows you to install additional Python packages that can be made available to aggregators, transformers, and estimators. - -## PyPI Packages - -Cortex looks for a `requirements.txt` file in the top level cortex directory (in the same level as `cortex.yaml`). All packages listed in `requirements.txt` will be made available to aggregators, transformers, and estimators. - -```text -./iris/ -├── cortex.yaml -├── requirements.txt -├── samples.json -├── implementations/ -└── resources/ -``` - -## Custom Packages - -Cortex looks for your Python packages in the directory `./packages/`. The package must have a `setup.py` in the root of the package directory with the name set to your package name. Cortex will run `pip3 wheel -w wheelhouse ./packages/` to construct wheels for the Python Project. - -Cortex Directory - -```text -./iris/ -├── cortex.yaml -├── samples.json -├── implementations/ -├── resources/ -└── packages - └── acme-util - ├── acme-util/ - | ├── util_a.py - | └── util_b.py - └── setup.py -``` - -Sample `setup.py` - -```python -from distutils.core import setup - -setup( - name="acme-util", - version="0.0.1", - description="", - author="ACME C. M. Exists", - author_email="acme@acme.com", - packages=["acme-util"], - install_requires=["pyyaml==3.13"], -) -``` From 20a9727682b66a3e3373c2b34bf9363f09102f7b Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 14:09:30 -0700 Subject: [PATCH 25/30] Update tutorial.md --- docs/apis/tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/apis/tutorial.md b/docs/apis/tutorial.md index 4997b09967..43d8a78cdf 100644 --- a/docs/apis/tutorial.md +++ b/docs/apis/tutorial.md @@ -100,4 +100,4 @@ Delete the deployment: $ cortex delete iris ``` -See [uninstall](operator/uninstall.md) if you'd like to uninstall Cortex. +See [uninstall](../cluster/uninstall.md) if you'd like to uninstall Cortex. From 99c40ef7d638c7a8d4b925ca591c7eeab027658f Mon Sep 17 00:00:00 2001 From: Omer Spillinger <42219498+ospillinger@users.noreply.github.com> Date: Tue, 25 Jun 2019 14:09:46 -0700 Subject: [PATCH 26/30] Update summary.md --- docs/summary.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/summary.md b/docs/summary.md index 9d798018c4..48416f681f 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -10,7 +10,6 @@ * [Deployments](apis/deployment.md) * [APIs](apis/apis.md) * [Packaging Models](apis/packaging-models.md) -* [Python Packages](apis/python-packages.md) * [Compute](apis/compute.md) * [CLI Commands](cluster/cli.md) * [Resource Statuses](apis/statuses.md) From 2413b0b43222af2b0989d83985e2264f19014cd4 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 14:19:22 -0700 Subject: [PATCH 27/30] Update docs --- docs/apis/apis.md | 2 ++ docs/apis/compute.md | 4 ---- docs/apis/deployment.md | 2 +- docs/apis/tutorial.md | 2 +- docs/pipelines/apis.md | 2 ++ docs/pipelines/deployment.md | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/apis/apis.md b/docs/apis/apis.md index 4f1b32b9ec..e08b8d3ad2 100644 --- a/docs/apis/apis.md +++ b/docs/apis/apis.md @@ -17,6 +17,8 @@ Serve models at scale and use them to build smarter applications. mem: # memory request per replica (default: Null) ``` +See [packaging models](packaging-models.md) for how to create the zipped model. + ## Example ```yaml diff --git a/docs/apis/compute.md b/docs/apis/compute.md index c331360257..8174b3f875 100644 --- a/docs/apis/compute.md +++ b/docs/apis/compute.md @@ -26,7 +26,3 @@ One unit of memory is one byte. Memory can be expressed as an integer or by usin ## GPU One unit of GPU corresponds to one virtual GPU on AWS. Fractional requests are not allowed. Here's some information on [adding GPU enabled nodes on EKS](https://docs.aws.amazon.com/en_ca/eks/latest/userguide/gpu-ami.html). - -## GPU Support - -We recommend using GPU compute requests on API resources only if you have enough nodes in your cluster to support the number of GPU requests in model training plus APIs (ideally with an autoscaler). Otherwise, due to the nature of zero downtime rolling updates, your model training will not have sufficient GPU resources as there will always be GPUs consumed by APIs from the previous deployment. diff --git a/docs/apis/deployment.md b/docs/apis/deployment.md index 8aae97e242..878c3e7cc0 100644 --- a/docs/apis/deployment.md +++ b/docs/apis/deployment.md @@ -1,6 +1,6 @@ # Deployment -The deployment resource is used to group a set of resources that can be deployed as a singular unit. It must be defined in every Cortex directory in a top-level `cortex.yaml` file. +The deployment resource is used to group a set of APIs that can be deployed as a single unit. It must be defined in every Cortex directory in a top-level `cortex.yaml` file. ## Config diff --git a/docs/apis/tutorial.md b/docs/apis/tutorial.md index 43d8a78cdf..0d5058c801 100644 --- a/docs/apis/tutorial.md +++ b/docs/apis/tutorial.md @@ -14,7 +14,7 @@ $ mkdir iris && cd iris $ touch cortex.yaml irises.json ``` -Cortex requires a `cortex.yaml` file which defines a `deployment` resource. Other resources may be defined in arbitrarily named YAML files in the the directory which contains `cortex.yaml` or any subdirectories. We will define all of our resources in `cortex.yaml` in this example. +Cortex requires a `cortex.yaml` file which defines a `deployment` resource. Other resources may be defined in arbitrarily named YAML files in the the directory which contains `cortex.yaml` or any subdirectories. We'll define all of our resources in `cortex.yaml` in this example. Add to `cortex.yaml`: diff --git a/docs/pipelines/apis.md b/docs/pipelines/apis.md index 97efc6e491..8bf3921df8 100644 --- a/docs/pipelines/apis.md +++ b/docs/pipelines/apis.md @@ -18,6 +18,8 @@ Serve models at scale and use them to build smarter applications. mem: # memory request per replica (default: Null) ``` +See [packaging models](packaging-models.md) for how to create the zipped model (for use in `external_model`). + ## Example ```yaml diff --git a/docs/pipelines/deployment.md b/docs/pipelines/deployment.md index 8aae97e242..2c2f75dbd0 100644 --- a/docs/pipelines/deployment.md +++ b/docs/pipelines/deployment.md @@ -1,6 +1,6 @@ # Deployment -The deployment resource is used to group a set of resources that can be deployed as a singular unit. It must be defined in every Cortex directory in a top-level `cortex.yaml` file. +The deployment resource is used to group a set of resources that can be deployed as a single unit. It must be defined in every Cortex directory in a top-level `cortex.yaml` file. ## Config From dcf260563f90baa49d87e24815dd6c767e1e1ddb Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 14:32:21 -0700 Subject: [PATCH 28/30] Update docs --- docs/apis/tutorial.md | 2 - docs/pipelines/tutorial.md | 158 +++++++++++++++++++++++++++++++++++++ docs/summary.md | 1 + examples/iris/cortex.yaml | 2 +- pkg/lib/aws/errors.go | 2 +- 5 files changed, 161 insertions(+), 4 deletions(-) create mode 100644 docs/pipelines/tutorial.md diff --git a/docs/apis/tutorial.md b/docs/apis/tutorial.md index 0d5058c801..a87615342b 100644 --- a/docs/apis/tutorial.md +++ b/docs/apis/tutorial.md @@ -30,8 +30,6 @@ An API makes your model available as a live web service that can serve real-time Add to `cortex.yaml`: ```yaml -# APIs - - kind: api name: iris-type external_model: diff --git a/docs/pipelines/tutorial.md b/docs/pipelines/tutorial.md new file mode 100644 index 0000000000..75a5176e9a --- /dev/null +++ b/docs/pipelines/tutorial.md @@ -0,0 +1,158 @@ +# Tutorial + +## Prerequisites + +1. An AWS account +1. A Kubernetes cluster running the Cortex operator ([installation instructions](operator/install.md)) +1. The Cortex CLI + +## Build a machine learning application + +Let's build and deploy a classifier using the famous [iris data set](https://archive.ics.uci.edu/ml/datasets/iris)! Below are a few samples of iris data: + +|sepal_length|sepal_width|petal_length|petal_width|class| +|:---:|:---:|:---:|:---:|:---| +|5.1|3.5|1.4|0.2|Iris-setosa| +|7.0|3.2|4.7|1.4|Iris-versicolor| +|6.3|3.3|6.0|2.5|Iris-virginica| + +Our goal is to build a web API that returns the type of iris given its measurements. + +#### cortex.yaml + +```text +mkdir iris && cd iris +touch cortex.yaml irises.json +``` + +Cortex requires an `cortex.yaml` file which defines a `deployment` resource. Other resources may be defined in arbitrarily named YAML files in the the directory which contains `cortex.yaml` or any subdirectories. For this example, we will define all of our resources in `cortex.yaml`. + +Add to `cortex.yaml`: + +```yaml +- kind: deployment + name: iris +``` + +#### Configure data ingestion + +Add to `cortex.yaml`: + +```yaml +# Environments + +- kind: environment + name: dev + data: + type: csv + path: s3a://cortex-examples/iris.csv + schema: [@sepal_length, @sepal_width, @petal_length, @petal_width, @class] +``` + +Cortex is able to read from any S3 bucket that your AWS credentials grant access to. + +#### Define the model + +This configuration will generate a training dataset with the specified columns and train our classifier using the generated dataset. Here we're using a built-in estimator (which uses TensorFlow's [DNNClassifier](https://www.tensorflow.org/api_docs/python/tf/estimator/DNNClassifier)) but Cortex supports any TensorFlow code that adheres to the [tf.estimator API](https://www.tensorflow.org/guide/estimators). + +Add to `cortex.yaml`: + +```yaml +# Models + +- kind: model + name: dnn + estimator: cortex.dnn_classifier + target_column: @class + input: + numeric_columns: [@sepal_length, @sepal_width, @petal_length, @petal_width] + target_vocab: ['Iris-setosa', 'Iris-versicolor', 'Iris-virginica'] + hparams: + hidden_units: [4, 2] + training: + batch_size: 10 + num_steps: 1000 +``` + +#### Define web APIs + +This will make the model available as a live web service that can serve real-time predictions. + +Add to `cortex.yaml`: + +```yaml +# APIs + +- kind: api + name: iris-type + model: @dnn + compute: + replicas: 2 +``` + +## Deploy the application + +```text +$ cortex deploy + +Deployment started +``` + +You can get a summary of the status of resources using `cortex status`: + +```text +$ cortex status --watch +``` + +#### Test the iris classification service + +Define a sample in `irises.json`: + +```javascript +{ + "samples": [ + { + "sepal_length": 5.2, + "sepal_width": 3.6, + "petal_length": 1.4, + "petal_width": 0.3 + } + ] +} +``` + +When the API is ready, request a prediction from the API: + +```text +$ cortex predict iris-type irises.json +``` + +#### Call the API from other clients (e.g. cURL) + +Get the API's endpoint: + +```text +$ cortex get api iris-type +``` + +Use cURL to test the API: + +```text +$ curl -k \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{ "samples": [ { "sepal_length": 5.2, "sepal_width": 3.6, "petal_length": 1.4, "petal_width": 0.3 } ] }' \ + +``` + +## Cleanup + +Delete the iris application: + +```text +$ cortex delete iris + +Deployment deleted +``` + +See [uninstall](operator/uninstall.md) if you'd like to uninstall Cortex. diff --git a/docs/summary.md b/docs/summary.md index 48416f681f..e6e71b906a 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -46,3 +46,4 @@ * [Compute](pipelines/compute.md) * [CLI Commands](cluster/cli.md) * [Resource Statuses](pipelines/statuses.md) +* [Tutorial](pipelines/tutorial.md) diff --git a/examples/iris/cortex.yaml b/examples/iris/cortex.yaml index c4ed4f56d6..11dbfcd67e 100644 --- a/examples/iris/cortex.yaml +++ b/examples/iris/cortex.yaml @@ -4,7 +4,7 @@ - kind: api name: iris-type external_model: - path: s3://cortex-examples/iris-model.zip + path: s3://cortex-examples/iris-tensorflow.zip region: us-west-2 compute: replicas: 3 diff --git a/pkg/lib/aws/errors.go b/pkg/lib/aws/errors.go index 634ba81e49..fea79819fd 100644 --- a/pkg/lib/aws/errors.go +++ b/pkg/lib/aws/errors.go @@ -114,7 +114,7 @@ func ErrorInvalidS3aPath(provided string) error { func ErrorInvalidS3Path(provided string) error { return Error{ Kind: ErrInvalidS3Path, - message: fmt.Sprintf("%s is not a valid s3 path (e.g. s3://cortex-examples/iris-model.zip is a valid s3 path)", s.UserStr(provided)), + message: fmt.Sprintf("%s is not a valid s3 path (e.g. s3://cortex-examples/iris-tensorflow.zip is a valid s3 path)", s.UserStr(provided)), } } From 9b78aae757aa341ce1d49151f4fd9aa9ee2aeea1 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 14:35:44 -0700 Subject: [PATCH 29/30] Update docs --- docs/pipelines/tutorial.md | 2 +- docs/summary.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pipelines/tutorial.md b/docs/pipelines/tutorial.md index 75a5176e9a..3ea98b45c5 100644 --- a/docs/pipelines/tutorial.md +++ b/docs/pipelines/tutorial.md @@ -1,4 +1,4 @@ -# Tutorial +# Pipeline Tutorial ## Prerequisites diff --git a/docs/summary.md b/docs/summary.md index e6e71b906a..222765c5c2 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -25,6 +25,7 @@ ## Pipeline Deployments * [Overview](pipelines/overview.md) +* [Tutorial](pipelines/tutorial.md) * [Deployments](pipelines/deployment.md) * [Environments](pipelines/environments.md) * [Raw Columns](pipelines/raw-columns.md) @@ -46,4 +47,3 @@ * [Compute](pipelines/compute.md) * [CLI Commands](cluster/cli.md) * [Resource Statuses](pipelines/statuses.md) -* [Tutorial](pipelines/tutorial.md) From 0fc19c275c260d732d548e20f59d13748c901a19 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 25 Jun 2019 14:37:42 -0700 Subject: [PATCH 30/30] Update tutorial.md --- docs/pipelines/tutorial.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pipelines/tutorial.md b/docs/pipelines/tutorial.md index 3ea98b45c5..fe5d4ce5df 100644 --- a/docs/pipelines/tutorial.md +++ b/docs/pipelines/tutorial.md @@ -3,7 +3,7 @@ ## Prerequisites 1. An AWS account -1. A Kubernetes cluster running the Cortex operator ([installation instructions](operator/install.md)) +1. A Kubernetes cluster running the Cortex operator ([installation instructions](../cluster/install.md)) 1. The Cortex CLI ## Build a machine learning application @@ -155,4 +155,4 @@ $ cortex delete iris Deployment deleted ``` -See [uninstall](operator/uninstall.md) if you'd like to uninstall Cortex. +See [uninstall](../cluster/uninstall.md) if you'd like to uninstall Cortex.