Creates named node pools for the job.
(self, job: GKEJob)
| 93 | |
| 94 | |
| 95 | class _JobProvisioningConfig(NamedTuple): |
| 96 | """Extracted provisioning parameters for a TPU job. |
| 97 | |
| 98 | Attributes: |
| 99 | acc_cfg: Accelerator config (provides num_replicas, instance_type, etc.). |
| 100 | job_sys_property: System characteristics for the TPU type. |
| 101 | topology: GKE topology string, or None if not applicable. |
| 102 | use_spot_vm: Whether to use spot VMs. |
| 103 | reservation: Reservation name (fully-qualified if cross-project), or None. |
| 104 | location_hint: Location hint for node pool placement, or None. |
| 105 | enable_tpu_ici_resiliency: Whether TPU ICI resiliency is enabled. |
| 106 | enable_tpu_smart_repair: Whether TPU smart repair is enabled. |
| 107 | job_priority: Job priority from the bastion jobspec, or None. |
| 108 | """ |
| 109 | |
| 110 | acc_cfg: AcceleratorConfig |
| 111 | job_sys_property: _SystemCharacteristics |
| 112 | topology: Optional[str] |
| 113 | use_spot_vm: bool |
| 114 | reservation: Optional[str] |
| 115 | location_hint: Optional[str] |
| 116 | enable_tpu_ici_resiliency: bool |
| 117 | enable_tpu_smart_repair: bool |
| 118 | job_priority: Optional[int] |
| 119 | |
| 120 | |
| 121 | class _NodePoolBatch(NamedTuple): |
| 122 | """A batch of node pools to create or delete. |
| 123 | |
| 124 | Attributes: |
| 125 | names: Node pool names (e.g. from construct_node_pool_name). |
| 126 | additional_labels_list: Per-pool label dicts, parallel to names. |
| 127 | Empty list for delete batches (labels are not used on delete). |
| 128 | """ |
| 129 | |
| 130 | names: list[str] |
| 131 | additional_labels_list: list[dict[str, str]] |
| 132 | |
| 133 | |
| 134 | class TPUNodePoolProvisioner(NodePoolProvisioner): |
| 135 | """TPU node pool provisioner.""" |
| 136 | |
| 137 | def _get_job_provisioning_config(self, job: GKEJob) -> _JobProvisioningConfig: |
| 138 | """Extracts and resolves all provisioning parameters from the job config. |
| 139 | |
| 140 | Args: |
| 141 | job: The GKEJob whose builder config carries TPU accelerator settings. |
| 142 | |
| 143 | Returns: |
| 144 | A _JobProvisioningConfig with all parameters needed by create_node_pools |
| 145 | or delete_node_pools. |
| 146 | |
| 147 | Raises: |
| 148 | TypeError: If the job's builder config is not a supported type. |
| 149 | """ |
| 150 | job_cfg: GKEJob.Config = job.config |
| 151 | builder_cfg: TPUReplicatedJob.Config | PathwaysLeaderWorkerTemplate.Config = job_cfg.builder |
| 152 |
nothing calls this directly
no test coverage detected