I have multiple User Managed Vertex AI Workbench instances running in my GCP Project.
Each can run one or more Jupyter Workspaces by clicking OPEN JUPYTERLAB
. Each Jupyter lab opens in a new browser tab.
From one of the Jupyter lab tabs, how can I tell which workbench instance or VM is hosting it?
EDIT: The first answer by @kiran mathew is not working for me because I have a custom docker container and that solution returns the hostname of the container which is not set to the Workench instance name. I changed the title of the question to be specific to custom containers.
2
Answers
Using the URL solution in the comment by @KiranMathew, here is a function to return the workbook name that works with custom docker containers.
Still anticipating a simpler approach will be available as foreshadowed by @gogasca
You can also get the project id with: http://metadata.google.internal/computeMetadata/v1/project/project-id
Python code:
I have two notebooks
stacckkk
andstackoverflow2
. When I ran the above code in these two notebook individually I got the below results.Result:
1st Notebook
2nd Notebook