Google cloud platform 如何访问Dataproc群集元数据?

Google cloud platform 如何访问Dataproc群集元数据?,google-cloud-platform,google-cloud-dataproc,Google Cloud Platform,Google Cloud Dataproc,创建集群后,我尝试检索其他组件的URL地址(不使用GCP仪表板)。我使用的是de,更具体地说是get\u cluster()函数 函数返回了大量数据,但我无法找到Jupyter网关URL或其他元数据 from google.cloud import dataproc_v1 project_id, cluster_name = '', '' region = 'europe-west4' client = dataproc_v1.ClusterControllerClient(

创建集群后,我尝试检索其他组件的URL地址(不使用GCP仪表板)。我使用的是de,更具体地说是
get\u cluster()
函数

函数返回了大量数据,但我无法找到Jupyter网关URL或其他元数据

from google.cloud import dataproc_v1

project_id, cluster_name = '', ''
region = 'europe-west4'

client = dataproc_v1.ClusterControllerClient(
                       client_options={
                            'api_endpoint': '{}-dataproc.googleapis.com:443'.format(region)
                        }
                    )


response = client.get_cluster(project_id, region, cluster_name)
print(response)
有人认为这是一个解决方案吗

如果您已通过启用组件网关来设置Jupyter访问,则可以访问所述的Web界面。诀窍在于,它包含在版本的API响应中

代码中所需的更改很少(除了
googleclouddataproc
library之外,没有其他要求)。只需将
dataproc\u v1
替换为
dataproc\u v1beta2
,并使用
response.config.endpoint\u config
访问端点:

从google.cloud导入dataproc_v1beta2
项目id,集群名称=“”“
地区='europe-west4'
client=dataproc\u v1beta2.ClusterControllerClient(
客户选择={
'api_endpoint':'{}-dataproc.googleapis.com:443'。格式(区域)
}
)
response=client.get\u cluster(项目\u id、区域、集群\u名称)
打印(response.config.endpoint\u config)
就我而言,我得到:

http\u端口{
键:“HDFS NameNode”
值:“https://REDACTED-dot-europe-west4.dataproc.googleusercontent.com/hdfs/dfshealth.html"
}
http_端口{
钥匙:“Jupyter”
值:“https://REDACTED-dot-europe-west4.dataproc.googleusercontent.com/jupyter/"
}
http_端口{
钥匙:“JupyterLab”
值:“https://REDACTED-dot-europe-west4.dataproc.googleusercontent.com/jupyter/lab/"
}
http_端口{
关键字:“MapReduce作业历史记录”
值:“https://REDACTED-dot-europe-west4.dataproc.googleusercontent.com/jobhistory/"
}
http_端口{
密钥:“Spark历史服务器”
值:“https://REDACTED-dot-europe-west4.dataproc.googleusercontent.com/sparkhistory/"
}
http_端口{
关键:“Tez”
值:“https://REDACTED-dot-europe-west4.dataproc.googleusercontent.com/apphistory/tez-ui/"
}
http_端口{
关键词:“纱线应用时间表”
值:“https://REDACTED-dot-europe-west4.dataproc.googleusercontent.com/apphistory/"
}
http_端口{
关键字:“纱线资源经理”
值:“https://REDACTED-dot-europe-west4.dataproc.googleusercontent.com/yarn/"
}
启用\u http\u端口\u访问:true
您需要使用v1beat2

使用以下选项启用组件:

“端点配置”:{
“启用\u http\u端口\u访问”:True
},
那么上面的答案就行了:

client.get\u集群(项目\u id、区域、集群\u名称)