Skip to content

Commit c469081

Browse files
committed
Remove "api" from response messages
1 parent 257aff8 commit c469081

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

build/test-examples.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ for example in $ROOT/examples/*/cortex.yaml; do
5454
echo "$result"
5555
if [ $prediction_exit_code -ne 0 ]; then
5656
# accommodate transient error `error: failed to connect to operator...`
57-
# handle `error: api ... is updating` error caused when the API status is set to `ready` but it actually isn't
58-
if [[ $result =~ ^error\:\ failed\ to\ connect\ to\ the\ operator.* ]] || [[ $result =~ ^error\:\ api.*is\ updating$ ]]; then
57+
# handle `error: api is updating` error caused when the API status is set to `ready` but it actually isn't
58+
if [[ $result =~ ^error\:\ failed\ to\ connect\ to\ the\ operator.* ]] || [[ $result =~ ^error\:\ .*is\ updating$ ]]; then
5959
echo "retrying prediction..."
6060
$retry="true"
6161
break # skip request predictions from the remaining APIs and try again

cli/cmd/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func delete(apiName string, keepCache bool) {
5454
if !_flagDeleteForce {
5555
readyReplicas := getReadyReplicasOrNil(apiName)
5656
if readyReplicas != nil && *readyReplicas > 2 {
57-
prompt.YesOrExit(fmt.Sprintf("are you sure you want to delete the %s api (which has %d live replicas)?", apiName, *readyReplicas), "", "")
57+
prompt.YesOrExit(fmt.Sprintf("are you sure you want to delete %s (which has %d live replicas)?", apiName, *readyReplicas), "", "")
5858
}
5959
}
6060

cli/cmd/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (e Error) Error() string {
100100
func ErrorAPINotReady(apiName string, status string) error {
101101
return errors.WithStack(Error{
102102
Kind: ErrAPINotReady,
103-
message: fmt.Sprintf("%s api is %s", s.UserStr(apiName), status),
103+
message: fmt.Sprintf("%s is %s", s.UserStr(apiName), status),
104104
})
105105
}
106106

examples/sklearn/iris-classifier/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Create a `cortex.yaml` file and add the configuration below. An `api` provides a
124124
```bash
125125
$ cortex deploy
126126
127-
creating iris-classifier api
127+
creating iris-classifier
128128
```
129129

130130
Track the status of your api using `cortex get`:
@@ -185,7 +185,7 @@ Run `cortex deploy` again to perform a rolling update to your API with the new c
185185
```bash
186186
$ cortex deploy
187187
188-
updating iris-classifier api
188+
updating iris-classifier
189189
```
190190

191191
After making more predictions, your `cortex get` command will show information about your API's past predictions:
@@ -228,7 +228,7 @@ You could also configure GPU compute here if your cluster supports it. Adding co
228228
```bash
229229
$ cortex deploy
230230
231-
updating iris-classifier api
231+
updating iris-classifier
232232
```
233233

234234
Run `cortex get` again:
@@ -284,8 +284,8 @@ Run `cortex deploy` to create the new API:
284284
```bash
285285
$ cortex deploy
286286
287-
iris-classifier api is up to date
288-
creating another-iris-classifier api
287+
iris-classifier is up to date
288+
creating another-iris-classifier
289289
```
290290

291291
`cortex deploy` is declarative so the `iris-classifier` API is unchanged while `another-iris-classifier` is created:
@@ -378,7 +378,7 @@ Run `cortex deploy` to create your batch API:
378378
```bash
379379
$ cortex deploy
380380
381-
creating batch-iris-classifier api
381+
creating batch-iris-classifier
382382
```
383383

384384
`cortex get` should show all 3 APIs now:
@@ -432,15 +432,15 @@ Run `cortex delete` to delete each API:
432432
```bash
433433
$ cortex delete iris-classifier
434434
435-
deleting iris-classifier api
435+
deleting iris-classifier
436436
437437
$ cortex delete another-iris-classifier
438438
439-
deleting another-iris-classifier api
439+
deleting another-iris-classifier
440440
441441
$ cortex delete batch-iris-classifier
442442
443-
deleting batch-iris-classifier api
443+
deleting batch-iris-classifier
444444
```
445445

446446
Running `cortex delete` will free up cluster resources and allow Cortex to scale down to the minimum number of instances you specified during cluster installation. It will not spin down your cluster.

pkg/operator/endpoints/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func Delete(w http.ResponseWriter, r *http.Request) {
5656
}
5757

5858
response := schema.DeleteResponse{
59-
Message: fmt.Sprintf("deleting %s api", apiName),
59+
Message: fmt.Sprintf("deleting %s", apiName),
6060
}
6161
respond(w, response)
6262
}

pkg/operator/operator/api.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func UpdateAPI(apiConfig *userconfig.API, projectID string, force bool) (*spec.A
5656
go deleteK8sResources(api.Name)
5757
return nil, "", err
5858
}
59-
return api, fmt.Sprintf("creating %s api", api.Name), nil
59+
return api, fmt.Sprintf("creating %s", api.Name), nil
6060
}
6161

6262
if !areAPIsEqual(prevDeployment, deploymentSpec(api, prevDeployment)) {
@@ -65,15 +65,15 @@ func UpdateAPI(apiConfig *userconfig.API, projectID string, force bool) (*spec.A
6565
return nil, "", err
6666
}
6767
if isUpdating && !force {
68-
return nil, "", errors.New(fmt.Sprintf("%s api is updating (override with --force)", api.Name))
68+
return nil, "", errors.New(fmt.Sprintf("%s is updating (override with --force)", api.Name))
6969
}
7070
if err := config.AWS.UploadMsgpackToS3(api, *config.Cluster.Bucket, api.Key); err != nil {
7171
return nil, "", errors.Wrap(err, "upload api spec")
7272
}
7373
if err := applyK8sResources(api, prevDeployment, prevService, prevVirtualService); err != nil {
7474
return nil, "", err
7575
}
76-
return api, fmt.Sprintf("updating %s api", api.Name), nil
76+
return api, fmt.Sprintf("updating %s", api.Name), nil
7777
}
7878

7979
// deployment didn't change
@@ -82,9 +82,9 @@ func UpdateAPI(apiConfig *userconfig.API, projectID string, force bool) (*spec.A
8282
return nil, "", err
8383
}
8484
if isUpdating {
85-
return api, fmt.Sprintf("%s api is already updating", api.Name), nil
85+
return api, fmt.Sprintf("%s is already updating", api.Name), nil
8686
}
87-
return api, fmt.Sprintf("%s api is up to date", api.Name), nil
87+
return api, fmt.Sprintf("%s is up to date", api.Name), nil
8888
}
8989

9090
func RefreshAPI(apiName string, force bool) (string, error) {
@@ -101,7 +101,7 @@ func RefreshAPI(apiName string, force bool) (string, error) {
101101
}
102102

103103
if isUpdating && !force {
104-
return "", errors.New(fmt.Sprintf("%s api is updating (override with --force)", apiName))
104+
return "", errors.New(fmt.Sprintf("%s is updating (override with --force)", apiName))
105105
}
106106

107107
apiID := prevDeployment.Labels["apiID"]
@@ -124,7 +124,7 @@ func RefreshAPI(apiName string, force bool) (string, error) {
124124
return "", err
125125
}
126126

127-
return fmt.Sprintf("updating %s api", api.Name), nil
127+
return fmt.Sprintf("updating %s", api.Name), nil
128128
}
129129

130130
func DeleteAPI(apiName string, keepCache bool) error {

pkg/operator/operator/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func ErrorDuplicateEndpointInOneDeploy(apis []userconfig.API) error {
181181
func ErrorDuplicateEndpoint(apiName string) error {
182182
return errors.WithStack(Error{
183183
Kind: ErrDuplicateEndpoint,
184-
message: fmt.Sprintf("endpoint is already being used by the %s api", apiName),
184+
message: fmt.Sprintf("endpoint is already being used by %s", apiName),
185185
})
186186
}
187187

@@ -317,6 +317,6 @@ func ErrorNoAvailableNodeComputeLimit(resource string, reqStr string, maxStr str
317317
func ErrorAPINotDeployed(apiName string) error {
318318
return errors.WithStack(Error{
319319
Kind: ErrAPINotDeployed,
320-
message: fmt.Sprintf("%s api is not deployed", apiName), // note: if modifying this string, search the codebase for it and change all occurrences
320+
message: fmt.Sprintf("%s is not deployed", apiName), // note: if modifying this string, search the codebase for it and change all occurrences
321321
})
322322
}

pkg/operator/operator/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func streamFromCloudWatch(apiName string, podCheckCancel chan struct{}, socket *
128128
}
129129

130130
if deployment == nil {
131-
writeAndCloseSocket(socket, "\n"+apiName+" api not found")
131+
writeAndCloseSocket(socket, "\n"+apiName+" not found")
132132
continue
133133
}
134134

pkg/types/userconfig/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func IdentifyAPI(filePath string, name string, index int) string {
7575
}
7676

7777
if name != "" {
78-
return str + "api: " + name
78+
return str + name
7979
} else if index >= 0 {
8080
return str + "api at " + s.Index(index)
8181
}

0 commit comments

Comments
 (0)