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

Function main

tpu/getVM.js:19–52  ·  view source on GitHub ↗
(tpuClient)

Source from the content-addressed store, hash-verified

17'use strict';
18
19async function main(tpuClient) {
20 // [START tpu_vm_get]
21 // Import the TPUClient
22 // TODO(developer): Uncomment below line before running the sample.
23 // const {TpuClient} = require('@google-cloud/tpu').v2;
24
25 // Instantiate a tpuClient
26 // TODO(developer): Uncomment below line before running the sample.
27 // tpuClient = new TpuClient();
28
29 // TODO(developer): Update these variables before running the sample.
30 // Project ID or project number of the Google Cloud project you want to retrive a node.
31 const projectId = await tpuClient.getProjectId();
32
33 // The name of TPU to retrive.
34 const nodeName = 'node-name-1';
35
36 // The zone, where the TPU is created.
37 const zone = 'europe-west4-a';
38
39 async function callGetTpuVM() {
40 const request = {
41 name: `projects/${projectId}/locations/${zone}/nodes/${nodeName}`,
42 };
43
44 const [response] = await tpuClient.getNode(request);
45
46 console.log(`Node: ${nodeName} retrived.`);
47 return response;
48 }
49
50 return await callGetTpuVM();
51 // [END tpu_vm_get]
52}
53
54module.exports = main;
55

Callers

nothing calls this directly

Calls 2

callGetTpuVMFunction · 0.85
getProjectIdMethod · 0.80

Tested by

no test coverage detected