简体   繁体   English

如何将 Jupyter Workspace 与其 Vertex AI Workbench 实例相关联

[英]How to associate a Jupyter Workspace with it's Vertex AI Workbench instance

I have multiple User Managed Vertex AI Workbench instances running in my GCP Project.我的 GCP 项目中运行了多个用户管理的 Vertex AI Workbench 实例。 Each can run one or more Jupyter Workspaces by clicking OPEN JUPYTERLAB .每个人都可以通过单击OPEN JUPYTERLAB来运行一个或多个 Jupyter 工作区。 Each Jupyter lab opens in a new browser tab.每个 Jupyter 实验室都会在新的浏览器选项卡中打开。 From one of the Jupyter lab tabs, how can I tell which workbench instance or VM is hosting it?从 Jupyter 实验室选项卡之一,我如何知道哪个工作台实例或 VM 正在托管它?

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 name of the container which is not set to the Workench instance name.编辑: @kiran mathew 的第一个答案对我不起作用,因为我有一个自定义的 docker 容器,并且该解决方案返回未设置为 Workench 实例名称的容器的主机名。

Python code: Python 代码:

import socket 
instance_name = socket.gethostname() 
print(instance_name)

I have two notebooks stacckkk and stackoverflow2 .我有两个笔记本stacckkkstackoverflow2 When I ran the above code in these two notebook individually I got the below results.当我在这两个笔记本中分别运行上面的代码时,我得到了以下结果。

在此处输入图像描述

Result:结果:

1st Notebook第一个笔记本

在此处输入图像描述

2nd Notebook第二个笔记本

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM