Skip to content

Commit b441088

Browse files
ospillingerdeliahu
authored andcommitted
update docs and examples (#601)
(cherry picked from commit e24cd2b)
1 parent 1f387a7 commit b441088

File tree

48 files changed

+117
-800
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+117
-800
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ The CLI sends configuration and code to the cluster every time you run `cortex d
102102

103103
## Examples
104104

105-
<!-- CORTEX_VERSION_README_MINOR x4 -->
106-
- [Sentiment analysis](https://github.com/cortexlabs/cortex/tree/0.11/examples/tensorflow/sentiment-analysis) in TensorFlow with BERT
105+
<!-- CORTEX_VERSION_README_MINOR x5 -->
106+
- [Sentiment analysis](https://github.com/cortexlabs/cortex/tree/0.11/examples/tensorflow/sentiment-analyzer) in TensorFlow with BERT
107107
- [Image classification](https://github.com/cortexlabs/cortex/tree/0.11/examples/tensorflow/image-classifier) in TensorFlow with Inception
108108
- [Text generation](https://github.com/cortexlabs/cortex/tree/0.11/examples/pytorch/text-generator) in PyTorch with DistilGPT2
109109
- [Reading comprehension](https://github.com/cortexlabs/cortex/tree/0.11/examples/pytorch/text-generator) in PyTorch with ELMo-BiDAF

cli/cmd/cluster.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,18 @@ func init() {
5757
}
5858

5959
func addClusterConfigFlag(cmd *cobra.Command) {
60-
cmd.PersistentFlags().StringVarP(&flagClusterConfig, "config", "c", "", "path to a Cortex cluster configuration file")
60+
cmd.PersistentFlags().StringVarP(&flagClusterConfig, "config", "c", "", "path to a cluster configuration file")
6161
cmd.PersistentFlags().SetAnnotation("config", cobra.BashCompFilenameExt, configFileExts)
6262
}
6363

6464
var clusterCmd = &cobra.Command{
6565
Use: "cluster",
66-
Short: "manage a Cortex cluster",
67-
Long: "Manage a Cortex cluster",
66+
Short: "manage a cluster",
6867
}
6968

7069
var upCmd = &cobra.Command{
7170
Use: "up",
72-
Short: "spin up a Cortex cluster",
73-
Long: `This command spins up a Cortex cluster on your AWS account.`,
71+
Short: "spin up a cluster",
7472
Args: cobra.NoArgs,
7573
Run: func(cmd *cobra.Command, args []string) {
7674
if err := checkDockerRunning(); err != nil {
@@ -97,8 +95,7 @@ var upCmd = &cobra.Command{
9795

9896
var updateCmd = &cobra.Command{
9997
Use: "update",
100-
Short: "update a Cortex cluster",
101-
Long: `This command updates a Cortex cluster.`,
98+
Short: "update a cluster",
10299
Args: cobra.NoArgs,
103100
Run: func(cmd *cobra.Command, args []string) {
104101
if err := checkDockerRunning(); err != nil {
@@ -126,8 +123,7 @@ var updateCmd = &cobra.Command{
126123

127124
var infoCmd = &cobra.Command{
128125
Use: "info",
129-
Short: "get information about a Cortex cluster",
130-
Long: `This command gets information about a Cortex cluster.`,
126+
Short: "get information about a cluster",
131127
Args: cobra.NoArgs,
132128
Run: func(cmd *cobra.Command, args []string) {
133129
if err := checkDockerRunning(); err != nil {
@@ -145,7 +141,9 @@ var infoCmd = &cobra.Command{
145141
if err != nil {
146142
errors.Exit(err)
147143
}
148-
if strings.Contains(out, "there isn't a cortex cluster") {
144+
145+
// note: if modifying this string, search the codebase for it and change all occurrences
146+
if strings.Contains(out, "there is no cluster") {
149147
errors.Exit()
150148
}
151149

@@ -176,8 +174,7 @@ var infoCmd = &cobra.Command{
176174

177175
var downCmd = &cobra.Command{
178176
Use: "down",
179-
Short: "spin down a Cortex cluster",
180-
Long: `This command spins down a Cortex cluster.`,
177+
Short: "spin down a cluster",
181178
Args: cobra.NoArgs,
182179
Run: func(cmd *cobra.Command, args []string) {
183180
if err := checkDockerRunning(); err != nil {
@@ -267,14 +264,16 @@ func refreshCachedClusterConfig(awsCreds *AWSCredentials) *clusterconfig.Cluster
267264
}
268265

269266
if userClusterConfig.Region == nil {
270-
errors.Exit(fmt.Sprintf("unable to find an existing cortex cluster; please configure \"%s\" to the s3 region of an existing cortex cluster or create a cortex cluster with `cortex cluster up`", clusterconfig.RegionKey))
267+
errors.Exit(fmt.Sprintf("unable to find an existing cluster; please configure \"%s\" to the s3 region of an existing cluster or create a cluster with `cortex cluster up`", clusterconfig.RegionKey))
271268
}
272269

273270
out, err := runRefreshClusterConfig(userClusterConfig, awsCreds)
274271
if err != nil {
275272
errors.Exit(err)
276273
}
277-
if strings.Contains(out, "there isn't a cortex cluster") {
274+
275+
// note: if modifying this string, search the codebase for it and change all occurrences
276+
if strings.Contains(out, "there is no cluster") {
278277
errors.Exit()
279278
}
280279

cli/cmd/completion.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,15 @@ import (
2626
var completionCmd = &cobra.Command{
2727
Use: "completion",
2828
Short: "generate bash completion scripts",
29-
Long: `Generate bash completion scripts.
29+
Long: `generate bash completion scripts
3030
31-
Add this to your bashrc or bash profile:
31+
add this to your bashrc or bash profile:
3232
source <(cortex completion)
33-
Or run:
34-
echo 'source <(cortex completion)' >> ~/.bash_profile # Mac
35-
echo 'source <(cortex completion)' >> ~/.bashrc # Linux
33+
or run:
34+
echo 'source <(cortex completion)' >> ~/.bash_profile # mac
35+
echo 'source <(cortex completion)' >> ~/.bashrc # linux
3636
37-
This will also add the "cx" alias.
38-
Note: Cortex CLI completion requires the bash_completion package to be installed on your system.
37+
this will also add the "cx" alias (note: cli completion requires the bash_completion package to be installed on your system)
3938
`,
4039
Args: cobra.NoArgs,
4140
Run: func(cmd *cobra.Command, args []string) {

cli/cmd/configure.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ func init() {
3333

3434
var configureCmd = &cobra.Command{
3535
Use: "configure",
36-
Short: "configure the CLI",
37-
Long: `This command configures the Cortex URL and AWS credentials
38-
in order to authenticate and send requests to Cortex.
39-
The configuration is stored in ~/.cortex.`,
40-
Args: cobra.NoArgs,
36+
Short: "configure the cli",
37+
Args: cobra.NoArgs,
4138
Run: func(cmd *cobra.Command, args []string) {
4239
if flagPrint {
4340
cliConfig := getDefaults()

cli/cmd/delete.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func init() {
3838
var deleteCmd = &cobra.Command{
3939
Use: "delete [DEPLOYMENT_NAME]",
4040
Short: "delete a deployment",
41-
Long: `This command deletes a deployment from the cluster.`,
4241
Args: cobra.MaximumNArgs(1),
4342
Run: func(cmd *cobra.Command, args []string) {
4443
var appName string

cli/cmd/deploy.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ var flagDeployRefresh bool
3838

3939
func init() {
4040
deployCmd.PersistentFlags().BoolVarP(&flagDeployForce, "force", "f", false, "override the in-progress deployment update")
41-
deployCmd.PersistentFlags().BoolVarP(&flagDeployRefresh, "refresh", "r", false, "re-deploy all APIs with cleared cache and rolling updates")
41+
deployCmd.PersistentFlags().BoolVarP(&flagDeployRefresh, "refresh", "r", false, "re-deploy all apis with cleared cache and rolling updates")
4242
addEnvFlag(deployCmd)
4343
}
4444

4545
var deployCmd = &cobra.Command{
4646
Use: "deploy",
4747
Short: "create or update a deployment",
48-
Long: `This command sends all project configuration and code to Cortex.
49-
If validations pass, Cortex will attempt to create the desired state.`,
50-
Args: cobra.NoArgs,
48+
Args: cobra.NoArgs,
5149
Run: func(cmd *cobra.Command, args []string) {
5250
deploy(flagDeployForce, flagDeployRefresh)
5351
},

cli/cmd/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func ErrorFailedConnectURL(url url.URL) error {
129129
func ErrorFailedToConnectOperator(urlStr string) error {
130130
return Error{
131131
Kind: ErrFailedToConnectOperator,
132-
message: fmt.Sprintf("failed to connect to the operator (%s), run `cortex configure` if you need to update the operator URL", urlStr),
132+
message: fmt.Sprintf("failed to connect to the operator (%s), run `cortex configure` if you need to update the operator endpoint", urlStr),
133133
}
134134
}
135135

cli/cmd/get.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ func init() {
5757

5858
var getCmd = &cobra.Command{
5959
Use: "get [API_NAME]",
60-
Short: "get information about APIs",
61-
Long: `This command displays information about APIs.
62-
Adding the -v or --verbose flag displays additional information.`,
63-
Args: cobra.RangeArgs(0, 1),
60+
Short: "get information about deployments",
61+
Args: cobra.RangeArgs(0, 1),
6462
Run: func(cmd *cobra.Command, args []string) {
6563
rerun(func() (string, error) {
6664
return runGet(cmd, args)
@@ -424,7 +422,7 @@ func classificationMetricsTable(apiMetrics schema.APIMetrics) string {
424422

425423
func describeModelInput(groupStatus *resource.APIGroupStatus, apiEndpoint string) string {
426424
if groupStatus.ReadyUpdated+groupStatus.ReadyStaleCompute == 0 {
427-
return "the model's input schema will be available when the API is live"
425+
return "the model's input schema will be available when the api is live"
428426
}
429427

430428
apiSummary, err := getAPISummary(apiEndpoint)
@@ -462,7 +460,7 @@ func describeModelInput(groupStatus *resource.APIGroupStatus, apiEndpoint string
462460
func getAPISummary(apiEndpoint string) (*schema.APISummary, error) {
463461
req, err := http.NewRequest("GET", apiEndpoint, nil)
464462
if err != nil {
465-
return nil, errors.Wrap(err, "unable to request API summary")
463+
return nil, errors.Wrap(err, "unable to request api summary")
466464
}
467465
req.Header.Set("Content-Type", "application/json")
468466
response, err := httpsNoVerifyClient.makeRequest(req)
@@ -473,7 +471,7 @@ func getAPISummary(apiEndpoint string) (*schema.APISummary, error) {
473471
var apiSummary schema.APISummary
474472
err = json.DecodeWithNumber(response, &apiSummary)
475473
if err != nil {
476-
return nil, errors.Wrap(err, "unable to parse API summary response")
474+
return nil, errors.Wrap(err, "unable to parse api summary response")
477475
}
478476

479477
for _, featureSignature := range apiSummary.ModelSignature {

cli/cmd/logs.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ func init() {
3131

3232
var logsCmd = &cobra.Command{
3333
Use: "logs API_NAME",
34-
Short: "get logs for an API",
35-
Long: `This command streams logs from a deployed API.`,
34+
Short: "stream logs from an api",
3635
Args: cobra.ExactArgs(1),
3736
Run: func(cmd *cobra.Command, args []string) {
3837
resourceName := args[0]

cli/cmd/predict.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ var predictDebug bool
3535
func init() {
3636
addAppNameFlag(predictCmd)
3737
addEnvFlag(predictCmd)
38-
predictCmd.Flags().BoolVar(&predictDebug, "debug", false, "Predict with debug mode")
38+
predictCmd.Flags().BoolVar(&predictDebug, "debug", false, "predict with debug mode")
3939
}
4040

4141
var predictCmd = &cobra.Command{
4242
Use: "predict API_NAME SAMPLE_FILE",
43-
Short: "make a prediction request",
44-
Long: `This command makes a prediction request using
45-
a JSON file and displays the response.`,
46-
Args: cobra.ExactArgs(2),
43+
Short: "make a prediction request using a json file",
44+
Args: cobra.ExactArgs(2),
4745
Run: func(cmd *cobra.Command, args []string) {
4846
apiName := args[0]
4947
sampleJSONPath := args[1]

0 commit comments

Comments
 (0)