Spaces:
Running
Running
Commit
·
dbb7ef8
1
Parent(s):
09df726
fix: fetch endpoint and model id manually
Browse files- cloudbuild-endpoint.yaml +7 -18
cloudbuild-endpoint.yaml
CHANGED
|
@@ -2,7 +2,6 @@ steps:
|
|
| 2 |
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
|
| 3 |
entrypoint: "bash"
|
| 4 |
id: upload-model
|
| 5 |
-
timeout: 600s
|
| 6 |
args:
|
| 7 |
- "-c"
|
| 8 |
- |
|
|
@@ -14,29 +13,17 @@ steps:
|
|
| 14 |
--container-health-route="/health" \
|
| 15 |
--display-name="interview-ai-detector-model"
|
| 16 |
|
| 17 |
-
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
|
| 18 |
-
entrypoint: "bash"
|
| 19 |
-
id: fetch-model
|
| 20 |
-
waitFor: ["upload-model"]
|
| 21 |
-
timeout: 600s
|
| 22 |
-
args:
|
| 23 |
-
- "-c"
|
| 24 |
-
- |
|
| 25 |
-
MODEL_ID=$(gcloud ai models list --region=us-central1 --format="value(name)" | head -n 1)
|
| 26 |
-
echo MODEL_ID > /workspace/model_id.txt
|
| 27 |
-
|
| 28 |
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
|
| 29 |
entrypoint: "bash"
|
| 30 |
id: create-endpoint
|
| 31 |
-
waitFor: ["
|
| 32 |
args:
|
| 33 |
- "-c"
|
| 34 |
- |
|
| 35 |
-
|
| 36 |
--region="us-central1" \
|
| 37 |
--display-name="interview-ai-detector-endpoint" \
|
| 38 |
-
--format="value(name)"
|
| 39 |
-
echo ENDPOINT_ID > /workspace/endpoint_id.txt
|
| 40 |
|
| 41 |
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
|
| 42 |
entrypoint: "bash"
|
|
@@ -44,9 +31,11 @@ steps:
|
|
| 44 |
args:
|
| 45 |
- "-c"
|
| 46 |
- |
|
| 47 |
-
gcloud ai
|
|
|
|
|
|
|
| 48 |
--region="us-central1" \
|
| 49 |
-
--model="${
|
| 50 |
--display-name="interview-ai-detector-deployment" \
|
| 51 |
--machine-type="n1-standard-4" \
|
| 52 |
--accelerator="count=1,type=nvidia-tesla-t4" \
|
|
|
|
| 2 |
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
|
| 3 |
entrypoint: "bash"
|
| 4 |
id: upload-model
|
|
|
|
| 5 |
args:
|
| 6 |
- "-c"
|
| 7 |
- |
|
|
|
|
| 13 |
--container-health-route="/health" \
|
| 14 |
--display-name="interview-ai-detector-model"
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
|
| 17 |
entrypoint: "bash"
|
| 18 |
id: create-endpoint
|
| 19 |
+
waitFor: ["upload-model"]
|
| 20 |
args:
|
| 21 |
- "-c"
|
| 22 |
- |
|
| 23 |
+
gcloud ai endpoints create \
|
| 24 |
--region="us-central1" \
|
| 25 |
--display-name="interview-ai-detector-endpoint" \
|
| 26 |
+
--format="value(name)"
|
|
|
|
| 27 |
|
| 28 |
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
|
| 29 |
entrypoint: "bash"
|
|
|
|
| 31 |
args:
|
| 32 |
- "-c"
|
| 33 |
- |
|
| 34 |
+
_MODEL_ID=$(gcloud ai models list --region=us-central1 --format="value(name)" | head -n 1)
|
| 35 |
+
_ENDPOINT_ID=$(gcloud ai endpoints list --region=us-central1 --format="value(name)" | head -n 1)
|
| 36 |
+
gcloud ai endpoints deploy-model "${_ENDPOINT_ID}" \
|
| 37 |
--region="us-central1" \
|
| 38 |
+
--model="${_MODEL_ID}" \
|
| 39 |
--display-name="interview-ai-detector-deployment" \
|
| 40 |
--machine-type="n1-standard-4" \
|
| 41 |
--accelerator="count=1,type=nvidia-tesla-t4" \
|