Compare commits

...
Author SHA1 Message Date
dpanigra 7156c751d8 feat: authenticate using sa 2025-12-12 19:46:11 +00:00
@@ -91,7 +91,7 @@
"id": "FUmKwF5ZMMS-"
},
"source": [
"## Authenticate your notebook environment (Colab only)"
"## Authenticate (option 1) your notebook environment (Colab only)"
]
},
{
@@ -129,14 +129,40 @@
},
"outputs": [],
"source": [
"gcp_project = \"\" # @param {type:\"string\"}\n",
"vertex_ai_url = \"\" # @param {type:\"string\"}\n",
"service_account_key = \"\" # @param {type:\"string\"}\n",
"# Keep Service account and token empty when using the key\n",
"service_account = \"\" # @param {type:\"string\"}\n",
"token = \"\" # @param {type:\"string\"}\n",
"code_whl = \"alphagenome-0.4.2.2-py3-none-any.whl\"\n",
"code_whl = \"alphagenome-0.4.2.3-py3-none-any.whl\"\n",
"file_path = f\"gs://alphagenome-whl/{code_whl}\"\n",
"\n",
"service_account = service_account or None\n",
"token = token or None\n"
"token = token or None"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "1902445c3133"
},
"source": [
"## Authenticate (option 2) using your service account key"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "1ed156e7c578"
},
"outputs": [],
"source": [
"import os\n",
"\n",
"!gcloud auth activate-service-account --key-file={service_account_key}\n",
"os.environ[\"GOOGLE_APPLICATION_CREDENTIALS\"] = service_account_key"
]
},
{
@@ -170,7 +196,7 @@
" print(f\"Service Account is set to '{service_account}'. Proceeding with the copy...\")\n",
" !gcloud config set auth/impersonate_service_account $service_account\n",
"print(f\"Downlaoding the wheel file: {file_path}\")\n",
"!gcloud storage cp {file_path} .\n",
"!gcloud storage cp {file_path} . --billing-project={gcp_project}\n",
"\n",
"# to unset impersonate_service_account\n",
"# !gcloud config unset auth/impersonate_service_account"
@@ -188,7 +214,7 @@
"from IPython.display import clear_output\n",
"\n",
"! pip install $code_whl\n",
"clear_output()"
"# clear_output()"
]
},
{