Im trying to create a Google Cloud TPU node using TPU client API and I cannot figure out the parent resource name of a TPU node in Google Cloud.
Below you can find the full code I'm using to create the node and I'm struggling to understand wht should be the value of the parent
attribute of the CreateNodeRequest
class:
def create_tpu_node(parent_resource_name, node_name, accelerator_type, runtime_version):
# Create a client
client = tpu_v2alpha1.TpuClient()
# Initialize request argument(s)
node = tpu_v2alpha1.Node()
node.name = node_name
node.accelerator_type = accelerator_type
node.runtime_version = runtime_version
request = tpu_v2alpha1.CreateNodeRequest(
parent=parent_resource_name,
node=node,
)
# Make the request
operation = client.create_node(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
return response
I have tried these parent resource names, among other combinations:
- projects/my-project-id/zones/europe-west4-a/tpus
- my-project-id/zones/europe-west4-a/tpus
And I always get, respectively, one of the following errors:
google.api_core.exceptions.InvalidArgument: 400 Malformed name: 'projects/my-project-id/zones/europe-west4-a/tpus/nodes/'
or
google.api_core.exceptions.InvalidArgument: 400 Invalid resource field value in the request.
I really have no clue how to get the TPU node parent resource name, or even a TPU node resource name. Any help would be much appreciated!
EDIT: I also tried with the following parent resource name projects/my-project-id/locations/europe-west4-a
, and I still get the gRPC error below:
status = StatusCode.INVALID_ARGUMENT details = "Malformed name: 'projects/my-project-id/locations/europe-west4-a/nodes/'" debug_error_string = "{"created":"@1645875905.514000000","description":"Error received from peer ipv4:142.251.36.42:443","file":"src/core/lib/surface/call.cc","file_line":1068,"grpc_message":"Malformed name: 'projects/my-project-id/locations/europe-west4-a/nodes/'","grpc_status":3}