MCPcopy Create free account
hub / github.com/apple/axlearn / create_node_pool

Function create_node_pool

axlearn/cloud/gcp/node_pool.py:403–490  ·  view source on GitHub ↗

Create a node pool. See also: https://googleapis.github.io/google-api-python-client/docs/dyn/container_v1.projects.locations.clusters.nodePools.html#create Args: name: Node pool name. project: GCP Project name. zone: GCP zone name. cluster: K8s cluster.

(
    name: str,
    *,
    project: str,
    zone: str,
    cluster: str,
    pre_provisioner_id: Optional[str] = None,
    num_nodes_per_pool: int,
    machine_type: str,
    topology: Optional[str] = None,
    use_spot_vm: Optional[bool] = None,
    reservation: Optional[str] = None,
    location_hint: Optional[str] = None,
    enable_tpu_ici_resiliency: Optional[bool] = None,
    service_account_email: Optional[str] = None,
    additional_labels: Optional[dict[str, str]] = None,
    disk_type: Optional[str] = None,
    boot_disk_kms_key: Optional[str] = None,
    enable_confidential_storage: Optional[bool] = None,
    fire_and_forget: bool = False,
)

Source from the content-addressed store, hash-verified

401 f"Timed out after {wait_timeout}s waiting for {names} node pools"
402 f" to delete. {elapsed_time} elapsed"
403 )
404
405 time.sleep(retry_interval)
406
407
408def create_node_pool(
409 name: str,
410 *,
411 project: str,
412 zone: str,
413 cluster: str,
414 pre_provisioner_id: Optional[str] = None,
415 num_nodes_per_pool: int,
416 machine_type: str,
417 topology: Optional[str] = None,
418 use_spot_vm: Optional[bool] = None,
419 reservation: Optional[str] = None,
420 location_hint: Optional[str] = None,
421 enable_tpu_ici_resiliency: Optional[bool] = None,
422 service_account_email: Optional[str] = None,
423 additional_labels: Optional[dict[str, str]] = None,
424 disk_type: Optional[str] = None,
425 boot_disk_kms_key: Optional[str] = None,
426 enable_confidential_storage: Optional[bool] = None,
427 fire_and_forget: bool = False,
428) -> Any:
429 """Create a node pool.
430
431 See also:
432 https://googleapis.github.io/google-api-python-client/docs/dyn/container_v1.projects.locations.clusters.nodePools.html#create
433
434 Args:
435 name: Node pool name.
436 project: GCP Project name.
437 zone: GCP zone name.
438 cluster: K8s cluster.
439 pre_provisioner_id: ID of the pre-provisioner.
440 It will be added to the node pool labels and can be used to
441 identify the node pools created by the same pre-provisioner.
442 num_nodes_per_pool: Number of node pools to create.
443 machine_type: Machine type of nodes in the node pools.
444 topology: TPU topology.
445 use_spot_vm: Whether to use spot VMs. It is mutually exclusive with reservation.
446 reservation: Name of TPU reservation. It is mutually exclusive with use_spot_vm.
447 location_hint: Location of TPU reservation.
448 enable_tpu_ici_resiliency: Whether to enable TPU ICI resiliency.
449 service_account_email: Service account email.
450 additional_labels: Additional labels attached to the node pool.
451 disk_type: Optional disk type for nodes (e.g. "pd-balanced").
452 boot_disk_kms_key: Optional KMS key for boot disk encryption.
453 enable_confidential_storage: Whether to enable confidential storage.
454 fire_and_forget: If True, execute creation and return immediately regardless of failures.
455 If False, raise an exception if node pool creation fails.
456
457 Returns:
458 Response of the v1 node pool creation API call.
459
460 Raises:

Callers 1

create_node_poolsFunction · 0.85

Calls 5

get_credentialsFunction · 0.90
_node_pool_parentFunction · 0.85
_node_pool_bodyFunction · 0.85
_node_pool_resourceFunction · 0.85
_create_node_poolFunction · 0.85

Tested by

no test coverage detected