GCP.TPU reference
GetNode
Section titled “GetNode”Source:
src/GCP/TPU/GetNode.ts
Runtime binding for Cloud TPU nodes.get.
Bind this operation to a Node in a Function/Action init phase.
Provide GetNodeHttp.
Grants roles/tpu.viewer on the project because Cloud TPU has no
resource-level IAM.
GetNode: Observing Nodes
Section titled “GetNode: Observing Nodes”const getNode = yield* GCP.TPU.GetNode(node);const live = yield* getNode();GetNodeHttp
Section titled “GetNodeHttp”Source:
src/GCP/TPU/GetNodeHttp.tsKind: Layer · Provides:GCP.TPU.GetNode
HTTP implementation of GetNode.
GetQueuedResource
Section titled “GetQueuedResource”Source:
src/GCP/TPU/GetQueuedResource.ts
Runtime binding for Cloud TPU queuedResources.get.
Bind this operation to a QueuedResource in a Function/Action
init phase. Provide GetQueuedResourceHttp.
Grants roles/tpu.viewer on the project because Cloud TPU has no
resource-level IAM.
GetQueuedResource: Observing Queued Resources
Section titled “GetQueuedResource: Observing Queued Resources”const getQueued = yield* GCP.TPU.GetQueuedResource(request);const live = yield* getQueued();GetQueuedResourceHttp
Section titled “GetQueuedResourceHttp”Source:
src/GCP/TPU/GetQueuedResourceHttp.tsKind: Layer · Provides:GCP.TPU.GetQueuedResource
HTTP implementation of GetQueuedResource.
Source:
src/GCP/TPU/Node.ts
A Cloud TPU node (TPU VM).
Changing nodeId, location, runtimeVersion, acceleratorType,
acceleratorConfig, cidrBlock, serviceAccount, scheduling,
boot/data disks, shielded config, or network identity (other than
enableExternalIps) replaces the node. Description, labels, metadata,
network tags, and networkConfig.enableExternalIps update in place.
Provisioning typically takes several minutes and requires Cloud TPU quota in the zone.
Node: Creating a Node
Section titled “Node: Creating a Node”Generated name, v2-8
const tpu = yield* GCP.TPU.Node("Trainer", {});Explicit id, labels, and description
const tpu = yield* GCP.TPU.Node("Trainer", { nodeId: "app-tpu", location: "us-central1-c", acceleratorType: "v2-8", runtimeVersion: "tpu-ubuntu2204-base", description: "training node", labels: { env: "prod" },});Node: Spot scheduling
Section titled “Node: Spot scheduling”const tpu = yield* GCP.TPU.Node("Trainer", { acceleratorType: "v2-8", schedulingConfig: { spot: true, preemptible: true },});QueuedResource
Section titled “QueuedResource”Source:
src/GCP/TPU/QueuedResource.ts
A Cloud TPU queued resource request. The request sits in a queue until capacity is available, then provisions the requested TPU node(s).
Queued resources have no labels field — Alchemy stamps ownership onto
each nested nodeSpec.node labels and description so list / nuke can
find them. The resource is create-only: changing identity or the node
spec replaces it.
QueuedResource: Creating a Queued Resource
Section titled “QueuedResource: Creating a Queued Resource”Default v2-8 request
const request = yield* GCP.TPU.QueuedResource("Trainer", {});Spot request with an explicit node spec
const request = yield* GCP.TPU.QueuedResource("Trainer", { location: "us-central1-c", spot: true, nodeSpec: [{ nodeId: "app-tpu", node: { acceleratorType: "v2-8", runtimeVersion: "tpu-ubuntu2204-base", labels: { env: "prod" }, }, }],});