Skip to content

Commit

Permalink
Test not running
Browse files Browse the repository at this point in the history
  • Loading branch information
twishabansal committed Oct 24, 2024
1 parent 89a2ed1 commit 93aab38
Show file tree
Hide file tree
Showing 4 changed files with 361 additions and 54 deletions.
104 changes: 50 additions & 54 deletions alloydb/notebooks/batch_embeddings_update.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,31 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"metadata": {
"id": "M_ppDxYf4Gqs"
},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"I0000 00:00:1729791146.216757 11765976 fork_posix.cc:77] Other threads are currently calling into gRPC, skipping fork() handlers\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mWARNING: google-cloud-aiplatform 1.70.0 does not provide the extra 'all'\u001b[0m\u001b[33m\n",
"\u001b[0m\u001b[33mWARNING: You are using pip version 22.0.4; however, version 24.2 is available.\n",
"You should consider upgrading via the '/Users/twishabansal/Documents/forks/python-docs-samples/bin/python -m pip install --upgrade pip' command.\u001b[0m\u001b[33m\n",
"\u001b[0m"
]
}
],
"source": [
"%pip install google-cloud-alloydb-connector[asyncpg]==1.4.0 sqlalchemy==2.0.36 pandas==2.2.3 vertexai==1.70.0 asyncio==3.4.3 greenlet==3.1.1 --quiet"
"%pip install google-cloud-alloydb-connector[asyncpg]==1.4.0 sqlalchemy==2.0.36 pandas==2.2.3 vertexai==1.70.0 asyncio==3.4.3 --quiet"
]
},
{
Expand Down Expand Up @@ -119,7 +137,7 @@
"# @markdown Please fill in the value below with your GCP project ID and then run the cell.\n",
"\n",
"# Please fill in these values.\n",
"project_id = \"my-project-id\" # @param {type:\"string\"}\n",
"project_id = \"twisha-dev\" # @param {type:\"string\"}\n",
"\n",
"# Quick input validations.\n",
"assert project_id, \"⚠️ Please provide a Google Cloud project ID\"\n",
Expand All @@ -134,15 +152,8 @@
"id": "O-oqMC5Ox-ZM"
},
"source": [
"### Enable APIs for AlloyDB and Vertex AI"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "X-bzfFb4A-xK"
},
"source": [
"### Enable APIs for AlloyDB and Vertex AI\n",
"\n",
"You will need to enable these APIs in order to create an AlloyDB database and utilize Vertex AI as an embeddings service!"
]
},
Expand Down Expand Up @@ -173,7 +184,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
Expand All @@ -187,16 +198,17 @@
"\n",
"# Please fill in these values.\n",
"region = \"us-central1\" # @param {type:\"string\"}\n",
"cluster_name = \"my-cluster\" # @param {type:\"string\"}\n",
"cluster_name = \"test-cluster\" # @param {type:\"string\"}\n",
"instance_name = \"my-primary\" # @param {type:\"string\"}\n",
"database_name = \"test_db\" # @param {type:\"string\"}\n",
"table_name = \"investments\"\n",
"password = input(\"Please provide a password to be used for 'postgres' database user: \")"
"table_name = \"investments\" # @param {type:\"string\"}\n",
"password = \"test_password\" # @param {type:\"string\"}\n",
"# password = input(\"Please provide a password to be used for 'postgres' database user: \")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"metadata": {
"id": "XXI1uUu3y8gc"
},
Expand Down Expand Up @@ -240,7 +252,7 @@
"outputs": [],
"source": [
"# create the AlloyDB Cluster\n",
"!gcloud beta alloydb clusters create {cluster_name} --password={password} --region={region}"
"# !gcloud beta alloydb clusters create {cluster_name} --password={password} --region={region}"
]
},
{
Expand All @@ -265,7 +277,7 @@
},
"outputs": [],
"source": [
"!gcloud beta alloydb instances create {instance_name} --instance-type=PRIMARY --cpu-count=2 --region={region} --cluster={cluster_name}"
"# !gcloud beta alloydb instances create {instance_name} --instance-type=PRIMARY --cpu-count=2 --region={region} --cluster={cluster_name}"
]
},
{
Expand All @@ -289,31 +301,7 @@
},
"outputs": [],
"source": [
"!gcloud beta alloydb instances update {instance_name} --region={region} --cluster={cluster_name} --assign-inbound-public-ip=ASSIGN_IPV4 --database-flags=\"password.enforce_complexity=on\""
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "UabC_qh5HOVy"
},
"source": [
"Please wait for the instance to be updated. This might take some time. You can see if the changes are reflecting using:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "_KC91mQZHABv",
"outputId": "6da8a6e4-549b-428d-a488-8dc993ddd216"
},
"outputs": [],
"source": [
"!gcloud beta alloydb instances describe {instance_name} --region={region} --cluster={cluster_name}"
"# !gcloud beta alloydb instances update {instance_name} --region={region} --cluster={cluster_name} --assign-inbound-public-ip=ASSIGN_IPV4 --database-flags=\"password.enforce_complexity=on\" --no-async"
]
},
{
Expand All @@ -329,7 +317,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 22,
"metadata": {
"id": "fYKVQzv2cjcm"
},
Expand Down Expand Up @@ -368,9 +356,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 23,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"I0000 00:00:1729792450.162148 11765976 fork_posix.cc:77] Other threads are currently calling into gRPC, skipping fork() handlers\n"
]
}
],
"source": [
"from google.cloud.alloydb.connector import AsyncConnector\n",
"\n",
Expand Down Expand Up @@ -645,7 +641,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 8,
"metadata": {
"id": "wvYGGRRoFXl4"
},
Expand All @@ -671,7 +667,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 9,
"metadata": {
"id": "IZgMik9XBW19"
},
Expand Down Expand Up @@ -715,7 +711,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 10,
"metadata": {
"id": "76qq6G38CZfm"
},
Expand Down Expand Up @@ -784,7 +780,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 11,
"metadata": {
"id": "4OYdrJk9Co0v"
},
Expand Down Expand Up @@ -916,7 +912,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 12,
"metadata": {
"id": "lEyvhlOCCr7F"
},
Expand Down Expand Up @@ -979,7 +975,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 13,
"metadata": {
"id": "rWb1T9aIBWa-"
},
Expand Down
Loading

0 comments on commit 93aab38

Please sign in to comment.