GCP.TPU reference
GetNode
Section titled “GetNode”Source:
packages/gcp/src/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:
packages/gcp/src/TPU/GetNodeHttp.tsKind: Layer · Provides:GCP.TPU.GetNode
HTTP implementation of GetNode.
GetQueuedResource
Section titled “GetQueuedResource”Source:
packages/gcp/src/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:
packages/gcp/src/TPU/GetQueuedResourceHttp.tsKind: Layer · Provides:GCP.TPU.GetQueuedResource
HTTP implementation of GetQueuedResource.
Source:
packages/gcp/src/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 },});Node: Looking up an existing node
Section titled “Node: Looking up an existing node”Node.lookup references a node Alchemy doesn’t manage (created in the
console or by another stack). It is read during plan/deploy, never
created, updated or deleted, and binds like a declared node.
const node = GCP.TPU.Node.lookup({ nodeId: "my-node" });QueuedResource
Section titled “QueuedResource”Source:
packages/gcp/src/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" }, }, }],});QueuedResource: Looking up an existing queued resource
Section titled “QueuedResource: Looking up an existing queued resource”QueuedResource.lookup references a queued resource Alchemy doesn’t
manage (created in the console or by another stack). It is read during
plan/deploy, never created, updated or deleted, and binds like a declared
queued resource.
const queuedResource = GCP.TPU.QueuedResource.lookup({ queuedResourceId: "my-queued-resource",});