我试图在GCP中编程创建"AI平台记事本“。gcloud确实支持管理这些笔记本,但不支持创建它们。而且没有客户端库来支持Node.js (我正在使用的语言)。但是,作为文档化的这里,GCP支持创建笔记本。但是,我很难确定如何在请求的JSON中指定我想要的笔记本。在GCP web UI中,我想要的设置是:
但我很难将其转换为REST的JSON请求。下面是我到目前为止的情况。我不确定其中任何一个都是正确的,而且我肯定缺少环境(tensorflow 2.1)和单用户访问权限。除了随机尝试不同的请求之外,我不知道如何实现它,直到它成功为止。(我只留下了一些JSON,只是根据文档指定了类型,以供参考)。
POST https://notebooks.googleapis.com/v1beta1/projects/my-project/locations/europe-west2/instances{
"name" : "testing-instance",
"instanceOwners": [
string
],
"serviceAccount": "team@project.iam.gserviceaccount.com",
"machineType": "e2-highmem-2 (Efficient Instance, 2 vCPUs, 16 GB RAM)",
"acceleratorConfig": {
object (AcceleratorConfig)
},
"state": enum (State),
"installGpuDriver": boolean,
"customGpuDriverPath": string,
"bootDiskType": enum (DiskType),
"bootDiskSizeGb": string,
"dataDiskType": enum (DiskType),
"dataDiskSizeGb": string,
"noRemoveDataDisk": boolean,
"diskEncryption": enum (DiskEncryption),
"kmsKey": string,
"noPublicIp": boolean,
"noProxyAccess": boolean,
"network": string,
"subnet": string,
"labels": {
string: string,
...
},
"metadata": {
string: string,
...
},
"createTime": string,
"updateTime": string,
// Union field environment can be only one of the following:
"vmImage": {
object (VmImage)
},
"containerImage": {
object (ContainerImage)
}
// End of list of possible types for union field environment.
}发布于 2020-09-09 20:04:56
这里需要的JSON
{
"name": "testing-instance",
"machineType": "zones/europe-west2-a/machineTypes/e2-highmem-2",
"guestAccelerators": [],
"metadata": {
"items": [
{
"key": "proxy-mode",
"value": "mail"
},
{
"key": "framework",
"value": "TensorFlow:2.1"
},
{
"key": "proxy-user-mail",
"value": "firstname.surname@email.com"
}
]
},
"disks": [
{
"boot": true,
"autoDelete": true,
"initializeParams": {
"diskType": "zones/europe-west2-a/diskTypes/pd-standard",
"diskSizeGb": "100",
"sourceImage": "projects/deeplearning-platform-release/global/images/family/tf2-2-1-cu101-notebooks-debian-9"
}
}
],
"scheduling": {
"onHostMaintenance": "MIGRATE"
},
"networkInterfaces": [
{
"subnetwork": "https://www.googleapis.com/compute/v1/projects/gbl-imt-homerider-basguillaueb/regions/europe-west2/subnetworks/datalab-network",
"accessConfigs": [
{
"name": "external-nat",
"type": "ONE_TO_ONE_NAT"
}
]
}
],
"serviceAccounts": [
{
"email": "team@project.iam.gserviceaccount.com",
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/userinfo.email"
]
}
],
"tags": {
"items": [
"deeplearning-vm"
]
}
}你自己不可能猜到。你好吗?使用控制台并在提交之前,打开Chorme调试器并捕获网络请求。post请求包含这个JSON!
尽情享受
https://stackoverflow.com/questions/63796703
复制相似问题