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..1acc7d7e1c 100644
--- a/README.md
+++ b/README.md
@@ -2,15 +2,13 @@
-**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) • [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 applications without worrying about setting up infrastructure, managing dependencies, or orchestrating data pipelines.
+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).
@@ -18,90 +16,48 @@ 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.
-
-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.
+**Define** your deployment using declarative configuration:
```yaml
-- kind: environment
- name: dev
- data:
- type: csv
- path: s3a://my-bucket/data.csv
- schema: [@col1, @col2, ...]
+- kind: api
+ name: my-api
+ external_model:
+ path: s3://my-bucket/my-model.zip
+ region: us-west-2
+ compute:
+ replicas: 3
+ gpu: 2
```
-**Data validation:** prevent data quality issues early.
+**Deploy** to your cloud infrastructure:
-```yaml
-- kind: raw_column
- name: col1
- type: INT_COLUMN
- min: 0
- max: 10
```
+$ cortex deploy
-**Data transformation:** use custom Python and PySpark code to transform data.
-
-```yaml
-- kind: transformed_column
- name: col1_normalized
- transformer_path: normalize.py # Python / PySpark code
- input: @col1
-```
-
-**Model training:** train models with custom TensorFlow code.
-
-```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
+Deploying ...
+Ready! https://amazonaws.com/my-api
```
-**Prediction serving:** serve real time predictions via JSON APIs.
+**Serve** real time predictions via scalable JSON APIs:
-```yaml
-- kind: api
- name: my-api
- model: @my_model
- compute:
- replicas: 3
```
+$ curl -d '{"a": 1, "b": 2, "c": 3}' https://amazonaws.com/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
+{ prediction: "def" }
```
## Key features
-- **Machine learning pipelines as code:** Cortex applications are defined using a simple declarative syntax that enables flexibility and reusability.
+- **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.
-- **End-to-end machine learning workflow:** Cortex spans the machine learning workflow from feature management to model training to prediction serving.
+- **Scalability:** Cortex can scale APIs to handle production workloads.
-- **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.
+- **Rolling updates:** Cortex updates deployed APIs without any downtime.
-- **Built for the cloud:** Cortex can handle production workloads and can be deployed in any AWS account in minutes.
+- **Cloud native:** Cortex can be deployed on any AWS account in minutes.
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/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{
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/apis/apis.md b/docs/apis/apis.md
new file mode 100644
index 0000000000..e08b8d3ad2
--- /dev/null
+++ b/docs/apis/apis.md
@@ -0,0 +1,47 @@
+# APIs
+
+Serve models at scale and use them to build smarter applications.
+
+## Config
+
+```yaml
+- kind: api
+ name: # API name (required)
+ external_model:
+ path: # path to a zipped model dir (e.g. s3://my-bucket/model.zip)
+ region: # S3 region (default: us-west-2)
+ compute:
+ replicas: # number of replicas to launch (default: 1)
+ cpu: # CPU request per replica (default: Null)
+ gpu: # gpu request per replica (default: Null)
+ mem: # memory request per replica (default: Null)
+```
+
+See [packaging models](packaging-models.md) for how to create the zipped model.
+
+## Example
+
+```yaml
+- kind: api
+ name: my-api
+ external_model:
+ path: s3://my-bucket/my-model.zip
+ region: us-west-2
+ 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/apis/compute.md b/docs/apis/compute.md
new file mode 100644
index 0000000000..8174b3f875
--- /dev/null
+++ b/docs/apis/compute.md
@@ -0,0 +1,28 @@
+# 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).
diff --git a/docs/apis/deployment.md b/docs/apis/deployment.md
new file mode 100644
index 0000000000..878c3e7cc0
--- /dev/null
+++ b/docs/apis/deployment.md
@@ -0,0 +1,17 @@
+# Deployment
+
+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
+
+```yaml
+- kind: deployment
+ name: # deployment name (required)
+```
+
+## Example
+
+```yaml
+- kind: deployment
+ name: my_deployment
+```
diff --git a/docs/apis/packaging-models.md b/docs/apis/packaging-models.md
new file mode 100644
index 0000000000..5d2c2deb00
--- /dev/null
+++ b/docs/apis/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/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/apis/tutorial.md b/docs/apis/tutorial.md
new file mode 100644
index 0000000000..a87615342b
--- /dev/null
+++ b/docs/apis/tutorial.md
@@ -0,0 +1,101 @@
+# Tutorial
+
+## Prerequisites
+
+1. A Kubernetes cluster running Cortex ([installation instructions](../cluster/install.md))
+2. The Cortex CLI
+
+## Deployment
+
+### cortex.yaml
+
+```text
+$ 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'll define all of our resources in `cortex.yaml` in this example.
+
+Add to `cortex.yaml`:
+
+```yaml
+- kind: deployment
+ name: iris
+```
+
+### Define an API
+
+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`:
+
+```yaml
+- kind: api
+ name: iris-type
+ external_model:
+ path: s3://cortex-examples/iris-tensorflow.zip
+ region: us-west-2
+ compute:
+ replicas: 3
+```
+
+### Deploy the API
+
+```text
+$ cortex deploy
+```
+
+You can get a summary of the status of resources using `cortex get`:
+
+```text
+$ cortex get --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 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 deployment:
+
+```text
+$ cortex delete iris
+```
+
+See [uninstall](../cluster/uninstall.md) if you'd like to uninstall Cortex.
diff --git a/docs/applications/advanced/external-models.md b/docs/applications/advanced/external-models.md
deleted file mode 100644
index b68a781b49..0000000000
--- a/docs/applications/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/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/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 51%
rename from docs/operator/cli.md
rename to docs/cluster/cli.md
index 1d5b64d846..e287771ecb 100644
--- a/docs/operator/cli.md
+++ b/docs/cluster/cli.md
@@ -2,8 +2,8 @@
## deploy
-```
-Deploy an application.
+```text
+Create or update a deployment.
Usage:
cortex deploy [flags]
@@ -14,11 +14,11 @@ 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 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:
@@ -30,95 +30,79 @@ Flags:
-h, --help help for refresh
```
-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
-```
+```text
Make predictions.
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.
+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
-```
-Delete an application.
+```text
+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
-```
+```text
Get information about resources.
Usage:
cortex get [RESOURCE_TYPE] [RESOURCE_NAME] [flags]
-Resource Types:
- raw_column
- aggregate
- transformed_column
- training_dataset
- model
- 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.
+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:
cortex logs [RESOURCE_TYPE] RESOURCE_NAME [flags]
-Resource Types:
- raw_column
- aggregate
- transformed_column
- training_dataset
- model
- 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).
## configure
-```
+```text
Configure the CLI.
Usage:
@@ -129,13 +113,11 @@ Flags:
-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:
@@ -151,5 +133,5 @@ Usage:
cortex completion [flags]
Flags:
- -h, --help help for completion
+ -h, --help
```
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/development.md b/docs/cluster/development.md
similarity index 99%
rename from docs/development.md
rename to docs/cluster/development.md
index 35e8025397..c9d0d43e83 100644
--- a/docs/development.md
+++ b/docs/cluster/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/install.md b/docs/cluster/install.md
similarity index 96%
rename from docs/operator/install.md
rename to docs/cluster/install.md
index a8cc12de9d..20ed12f141 100644
--- a/docs/operator/install.md
+++ b/docs/cluster/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
@@ -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
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/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/applications/resources/aggregates.md b/docs/pipelines/aggregates.md
similarity index 100%
rename from docs/applications/resources/aggregates.md
rename to docs/pipelines/aggregates.md
diff --git a/docs/applications/implementations/aggregators.md b/docs/pipelines/aggregators-custom.md
similarity index 100%
rename from docs/applications/implementations/aggregators.md
rename to docs/pipelines/aggregators-custom.md
diff --git a/docs/applications/resources/aggregators.md b/docs/pipelines/aggregators.md
similarity index 94%
rename from docs/applications/resources/aggregators.md
rename to docs/pipelines/aggregators.md
index 38cfe6b26f..62c16d7bfa 100644
--- a/docs/applications/resources/aggregators.md
+++ b/docs/pipelines/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/pipelines/apis.md
similarity index 79%
rename from docs/applications/resources/apis.md
rename to docs/pipelines/apis.md
index ee0f9dfe8c..8bf3921df8 100644
--- a/docs/applications/resources/apis.md
+++ b/docs/pipelines/apis.md
@@ -13,24 +13,27 @@ Serve models at scale and use them to build smarter applications.
region: # S3 region (default: us-west-2)
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)
```
+See [packaging models](packaging-models.md) for how to create the zipped model (for use in `external_model`).
+
## Example
```yaml
- kind: api
- name: classifier
+ name: my-api
model: @dnn
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}/{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/advanced/compute.md b/docs/pipelines/compute.md
similarity index 99%
rename from docs/applications/advanced/compute.md
rename to docs/pipelines/compute.md
index 56029af150..c331360257 100644
--- a/docs/applications/advanced/compute.md
+++ b/docs/pipelines/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/applications/resources/constants.md b/docs/pipelines/constants.md
similarity index 100%
rename from docs/applications/resources/constants.md
rename to docs/pipelines/constants.md
diff --git a/docs/applications/resources/data-types.md b/docs/pipelines/data-types.md
similarity index 98%
rename from docs/applications/resources/data-types.md
rename to docs/pipelines/data-types.md
index f124e914bd..428cfa4e04 100644
--- a/docs/applications/resources/data-types.md
+++ b/docs/pipelines/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/pipelines/deployment.md b/docs/pipelines/deployment.md
new file mode 100644
index 0000000000..2c2f75dbd0
--- /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 single 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/environments.md b/docs/pipelines/environments.md
similarity index 100%
rename from docs/applications/resources/environments.md
rename to docs/pipelines/environments.md
diff --git a/docs/applications/implementations/estimators.md b/docs/pipelines/estimators-custom.md
similarity index 100%
rename from docs/applications/implementations/estimators.md
rename to docs/pipelines/estimators-custom.md
diff --git a/docs/applications/resources/estimators.md b/docs/pipelines/estimators.md
similarity index 95%
rename from docs/applications/resources/estimators.md
rename to docs/pipelines/estimators.md
index 4cb02092a0..c9874d1103 100644
--- a/docs/applications/resources/estimators.md
+++ b/docs/pipelines/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/models.md b/docs/pipelines/models.md
similarity index 100%
rename from docs/applications/resources/models.md
rename to docs/pipelines/models.md
diff --git a/docs/applications/resources/overview.md b/docs/pipelines/overview.md
similarity index 54%
rename from docs/applications/resources/overview.md
rename to docs/pipelines/overview.md
index 855c43a536..1a93950f16 100644
--- a/docs/applications/resources/overview.md
+++ b/docs/pipelines/overview.md
@@ -1,22 +1,10 @@
# 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`:
-
-* [app](app.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.
-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/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/applications/advanced/python-packages.md b/docs/pipelines/python-packages.md
similarity index 82%
rename from docs/applications/advanced/python-packages.md
rename to docs/pipelines/python-packages.md
index ed1312527c..b5a6d336be 100644
--- a/docs/applications/advanced/python-packages.md
+++ b/docs/pipelines/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/resources/raw-columns.md b/docs/pipelines/raw-columns.md
similarity index 100%
rename from docs/applications/resources/raw-columns.md
rename to docs/pipelines/raw-columns.md
diff --git a/docs/applications/resources/statuses.md b/docs/pipelines/statuses.md
similarity index 100%
rename from docs/applications/resources/statuses.md
rename to docs/pipelines/statuses.md
diff --git a/docs/applications/advanced/templates.md b/docs/pipelines/templates.md
similarity index 91%
rename from docs/applications/advanced/templates.md
rename to docs/pipelines/templates.md
index 25a0c5a544..ccfd82a689 100644
--- a/docs/applications/advanced/templates.md
+++ b/docs/pipelines/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/transformed-columns.md b/docs/pipelines/transformed-columns.md
similarity index 100%
rename from docs/applications/resources/transformed-columns.md
rename to docs/pipelines/transformed-columns.md
diff --git a/docs/applications/implementations/transformers.md b/docs/pipelines/transformers-custom.md
similarity index 100%
rename from docs/applications/implementations/transformers.md
rename to docs/pipelines/transformers-custom.md
diff --git a/docs/applications/resources/transformers.md b/docs/pipelines/transformers.md
similarity index 94%
rename from docs/applications/resources/transformers.md
rename to docs/pipelines/transformers.md
index 3ba071b9da..7f3687e071 100644
--- a/docs/applications/resources/transformers.md
+++ b/docs/pipelines/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/tutorial.md b/docs/pipelines/tutorial.md
similarity index 85%
rename from docs/tutorial.md
rename to docs/pipelines/tutorial.md
index 0efb14de15..fe5d4ce5df 100644
--- a/docs/tutorial.md
+++ b/docs/pipelines/tutorial.md
@@ -1,9 +1,9 @@
-# Tutorial
+# Pipeline Tutorial
## 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
@@ -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
+#### cortex.yaml
-```bash
+```text
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
```
@@ -92,7 +92,7 @@ Add to `cortex.yaml`:
## Deploy the application
-```
+```text
$ cortex deploy
Deployment started
@@ -100,7 +100,7 @@ Deployment started
You can get a summary of the status of resources using `cortex status`:
-```
+```text
$ cortex status --watch
```
@@ -123,7 +123,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
```
@@ -131,13 +131,13 @@ $ cortex predict iris-type irises.json
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" \
@@ -149,10 +149,10 @@ $ curl -k \
Delete the iris application:
-```
+```text
$ 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.
diff --git a/docs/summary.md b/docs/summary.md
index 7d0da682f3..222765c5c2 100644
--- a/docs/summary.md
+++ b/docs/summary.md
@@ -1,49 +1,49 @@
# Summary
-* [Read Me](../README.md)
-* [Install](operator/install.md)
-* [Tutorial](tutorial.md)
-* [Application Overview](applications/resources/overview.md)
-* [CLI Commands](operator/cli.md)
+* [README](../README.md)
+* [Install](cluster/install.md)
+* [Tutorial](apis/tutorial.md)
* [Examples](https://github.com/cortexlabs/cortex/tree/master/examples)
-* [GitHub](https://github.com/cortexlabs/cortex)
-* [FAQ](faq.md)
-## Applications
-
-### Resources
-
- * [Application](applications/resources/app.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 Deployments
+
+* [Deployments](apis/deployment.md)
+* [APIs](apis/apis.md)
+* [Packaging Models](apis/packaging-models.md)
+* [Compute](apis/compute.md)
+* [CLI Commands](cluster/cli.md)
+* [Resource Statuses](apis/statuses.md)
+
+## Cluster
+
+* [AWS Credentials](cluster/aws.md)
+* [Config](cluster/config.md)
+* [Security](cluster/security.md)
+* [Uninstall](cluster/uninstall.md)
+* [Development](cluster/development.md)
+
+## Pipeline Deployments
+
+* [Overview](pipelines/overview.md)
+* [Tutorial](pipelines/tutorial.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)
+* [Packaging Models](pipelines/packaging-models.md)
+* [Python Packages](pipelines/python-packages.md)
+* [Compute](pipelines/compute.md)
+* [CLI Commands](cluster/cli.md)
+* [Resource Statuses](pipelines/statuses.md)
diff --git a/examples/external-model/cortex.yaml b/examples/external-model/cortex.yaml
deleted file mode 100644
index 57ddaa01f8..0000000000
--- a/examples/external-model/cortex.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-- kind: app
- 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/fraud/cortex.yaml b/examples/fraud/cortex.yaml
deleted file mode 100644
index 01c245fa53..0000000000
--- a/examples/fraud/cortex.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-- kind: app
- name: fraud
diff --git a/examples/insurance/cortex.yaml b/examples/insurance/cortex.yaml
deleted file mode 100644
index 1ae1e70a8b..0000000000
--- a/examples/insurance/cortex.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-- kind: app
- name: insurance
diff --git a/examples/iris/cortex.yaml b/examples/iris/cortex.yaml
index 34ff5d2fad..11dbfcd67e 100644
--- a/examples/iris/cortex.yaml
+++ b/examples/iris/cortex.yaml
@@ -1,28 +1,10 @@
-- kind: app
+- 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
+ external_model:
+ path: s3://cortex-examples/iris-tensorflow.zip
+ region: us-west-2
compute:
- replicas: 1
+ replicas: 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
diff --git a/examples/mnist/cortex.yaml b/examples/mnist/cortex.yaml
deleted file mode 100644
index a7d2a42bf9..0000000000
--- a/examples/mnist/cortex.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-- kind: app
- name: mnist
diff --git a/examples/pipelines/fraud/cortex.yaml b/examples/pipelines/fraud/cortex.yaml
new file mode 100644
index 0000000000..8c2325bf3c
--- /dev/null
+++ b/examples/pipelines/fraud/cortex.yaml
@@ -0,0 +1,2 @@
+- kind: deployment
+ name: fraud
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/pipelines/insurance/cortex.yaml b/examples/pipelines/insurance/cortex.yaml
new file mode 100644
index 0000000000..801579a00c
--- /dev/null
+++ b/examples/pipelines/insurance/cortex.yaml
@@ -0,0 +1,2 @@
+- kind: deployment
+ name: insurance
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..6e253d9149
--- /dev/null
+++ b/examples/pipelines/iris/cortex.yaml
@@ -0,0 +1,28 @@
+- kind: deployment
+ name: iris-e2e
+
+- 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/iris/irises.json b/examples/pipelines/iris/samples.json
similarity index 100%
rename from examples/iris/irises.json
rename to examples/pipelines/iris/samples.json
diff --git a/examples/pipelines/mnist/cortex.yaml b/examples/pipelines/mnist/cortex.yaml
new file mode 100644
index 0000000000..3bbb3c6ff3
--- /dev/null
+++ b/examples/pipelines/mnist/cortex.yaml
@@ -0,0 +1,2 @@
+- kind: deployment
+ name: mnist
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 53%
rename from examples/movie-ratings/cortex.yaml
rename to examples/pipelines/movie-ratings/cortex.yaml
index e9dda0b34b..4898b600b0 100644
--- a/examples/movie-ratings/cortex.yaml
+++ b/examples/pipelines/movie-ratings/cortex.yaml
@@ -1,2 +1,2 @@
-- kind: app
+- kind: deployment
name: movie-ratings
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 98%
rename from examples/poker/cortex.yaml
rename to examples/pipelines/poker/cortex.yaml
index cd94bbce2b..65b7bff032 100644
--- a/examples/poker/cortex.yaml
+++ b/examples/pipelines/poker/cortex.yaml
@@ -1,4 +1,4 @@
-- kind: app
+- kind: deployment
name: poker
- kind: environment
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/pipelines/reviews/cortex.yaml b/examples/pipelines/reviews/cortex.yaml
new file mode 100644
index 0000000000..dd6a6af846
--- /dev/null
+++ b/examples/pipelines/reviews/cortex.yaml
@@ -0,0 +1,2 @@
+- kind: deployment
+ name: reviews
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/pipelines/wine/cortex.yaml b/examples/pipelines/wine/cortex.yaml
new file mode 100644
index 0000000000..20fc379429
--- /dev/null
+++ b/examples/pipelines/wine/cortex.yaml
@@ -0,0 +1,2 @@
+- kind: deployment
+ name: wine
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
diff --git a/examples/reviews/cortex.yaml b/examples/reviews/cortex.yaml
deleted file mode 100644
index 109c799afd..0000000000
--- a/examples/reviews/cortex.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-- kind: app
- name: reviews
diff --git a/examples/wine/cortex.yaml b/examples/wine/cortex.yaml
deleted file mode 100644
index 49286d8bb7..0000000000
--- a/examples/wine/cortex.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-- kind: app
- name: wine
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)),
}
}
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: