如何使用REST API创建新的工作台管理笔记本



如何以编程方式创建新的托管笔记本?我想使用笔记本API REST,但还没有找到一个例子。

参考链路

要创建新的托管笔记本,可以使用以下示例:

BASE_ADDRESS=notebooks.googleapis.com
LOCATION=us-central1
PROJECT_ID=gogasca-sandbox
AUTH_TOKEN=$(gcloud auth application-default print-access-token)
RUNTIME_BODY="{
'access_config': {
'access_type': 'SINGLE_USER',
'runtime_owner': 'gogasca@google.com'
},
'virtual_machine': {
'virtual_machine_config': {
'data_disk': {
'initialize_params': {
'disk_size_gb': 200,
'disk_type': 'PD_SSD',
}
},
'container_images': [{
'repository': 'gcr.io/deeplearning-platform-release/pytorch-gpu', 'tag': 'latest'
}],
'metadata': {
'file_to_load_1':'https://test.google.com/v2/models/versions/trainable_v1.0/zip',
},
'machine_type':'n1-standard-4',
'accelerator_config': {
'type': 'NVIDIA_TESLA_T4',
'core_count': '1'
}
}
},
'software_config':{
'post_startup_script':'gs://gcp-scripts/step01.sh'
}
}"
RUNTIME_NAME=gogasca-managed-notebook
curl -X POST https://${BASE_ADDRESS}/v1/projects/$PROJECT_ID/locations/$LOCATION/runtimes?runtime_id=$RUNTIME_NAME -d "${RUNTIME_BODY}" 
-H "Content-Type: application/json" 
-H "Authorization: Bearer $AUTH_TOKEN" -v

谷歌云SDK正在进行中。Terraform模块刚刚发布。

最新更新