MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / callCreateTpuVM

Function callCreateTpuVM

tpu/createVM.js:58–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56 const tpuSoftwareVersion = 'v2-tpuv5-litepod';
57
58 async function callCreateTpuVM() {
59 // Create a node
60 const node = new Node({
61 name: nodeName,
62 zone,
63 acceleratorType: tpuType,
64 runtimeVersion: tpuSoftwareVersion,
65 // Define network
66 networkConfig: new NetworkConfig({
67 enableExternalIps: true,
68 network: `projects/${projectId}/global/networks/${networkName}`,
69 subnetwork: `projects/${projectId}/regions/${region}/subnetworks/${networkName}`,
70 }),
71 });
72
73 const parent = `projects/${projectId}/locations/${zone}`;
74 const request = {parent, node, nodeId: nodeName};
75
76 const [operation] = await tpuClient.createNode(request);
77
78 // Wait for the create operation to complete.
79 const [response] = await operation.promise();
80
81 console.log(`TPU VM: ${nodeName} created.`);
82 return response;
83 }
84 return await callCreateTpuVM();
85 // [END tpu_vm_create]
86}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected