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

Function main

tpu/getVMList.js:19–48  ·  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_list]
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 list of TPU nodes.
31 const projectId = await tpuClient.getProjectId();
32
33 // The zone from which the TPUs are retrived.
34 const zone = 'europe-west4-a';
35
36 async function callTpuVMList() {
37 const request = {
38 parent: `projects/${projectId}/locations/${zone}`,
39 };
40
41 const [response] = await tpuClient.listNodes(request);
42
43 return response;
44 }
45
46 return await callTpuVMList();
47 // [END tpu_vm_list]
48}
49
50module.exports = main;
51

Callers

nothing calls this directly

Calls 2

callTpuVMListFunction · 0.85
getProjectIdMethod · 0.80

Tested by

no test coverage detected