큐에 추가된 리소스 사용자 가이드

큐에 추가된 리소스를 사용하면 큐에 추가된 방식으로 Cloud TPU 리소스를 요청할 수 있습니다. 큐에 추가된 리소스를 요청하면 요청이 Cloud TPU 서비스에서 유지보수하는 큐에 추가됩니다. 요청된 리소스를 사용할 수 있게 되면 즉시 독점으로 사용 가능하도록 Google Cloud 프로젝트에 할당됩니다. 삭제 또는 선점되지 않는 한 프로젝트에 할당된 상태로 유지됩니다. 선점형 TPU만 선점할 수 있습니다.

큐에 추가된 리소스 요청에서 선택적 시작 및 종료 시간을 지정할 수 있습니다. 시작 시간은 요청을 채울 가장 이른 시간을 지정합니다. 지정된 종료 시간까지 요청이 작성되지 않으면 요청이 만료됩니다. 요청이 만료된 후에도 큐에 남아 있습니다.

큐에 추가된 리소스 요청은 다음 상태 중 하나일 수 있습니다.

WAITING_FOR_RESOURCES
요청이 초기 검증을 통과하여 큐에 추가되었습니다. 요청을 프로비저닝하거나 할당 간격을 경과하기에 충분한 무료 리소스가 확보될 때까지 이 상태가 유지됩니다. 수요가 많은 경우 모든 요청을 즉시 프로비저닝할 수 없습니다. TPU에 대한 더욱 안정적인 확보 가능성이 필요한 경우 예약을 구매하는 것이 좋습니다.
PROVISIONING
큐에서 요청이 선택되었으며 현재 리소스가 할당되고 있습니다.
ACTIVE
요청이 할당되었습니다. 큐에 추가된 리소스 요청이 ACTIVE 상태라면 TPU 관리에 설명된 대로 TPU VM을 관리할 수 있습니다.
FAILED
요청에 문제가 있거나 요청한 리소스를 할당 간격 내에서 사용할 수 없으므로 요청을 완료할 수 없습니다. 이 요청은 명시적으로 삭제될 때까지 큐에 남아 있습니다.
SUSPENDING
요청과 연결된 리소스를 현재 삭제하는 중입니다.
SUSPENDED
요청에 지정된 리소스가 삭제되었습니다. 요청이 SUSPENDED 상태이면 더 이상 할당할 수 없습니다.

기본 요건

이 가이드의 명령어를 실행하기 전에 다음을 수행해야 합니다.

주문형 큐에 추가된 리소스 요청

gcloud compute tpus queued-resources create 명령어를 사용하여 큐에 추가된 주문형 리소스를 요청할 수 있습니다. 주문형 리소스에 대한 자세한 내용은 할당량 유형을 참조하세요.

gcloud

gcloud alpha compute tpus queued-resources create your-queued-resource-id \
--node-id your-node-id \
--project your-project \
--zone us-central2-b \
--accelerator-type v4-8 \
--runtime-version tpu-vm-tf-2.16.1-pjrt

curl

curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{
'tpu': {
  'node_spec': {
    'parent': 'projects/your-project-number/locations/us-central2-b',
    'node_id': 'your-node-id',
    'node': {
      'accelerator_type': 'v4-8',
      'runtime_version': 'tpu-vm-tf-2.16.1-pjrt',
    }
  }
}
}" \
https://tpu.googleapis.com/v2alpha1/projects/your-project-id/locations/us-central2-b/queuedResources?queued_resource_id=your-queued-resource-id

명령어 매개변수 설명

queued-resource-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
node-id
큐에 추가된 리소스 요청이 할당될 때 생성되는 TPU의 사용자 할당 ID입니다.
project
Google Cloud 프로젝트.
zone
Cloud TPU를 생성하려는 영역입니다.
accelerator-type
가속기 유형은 만들려는 Cloud TPU의 버전과 크기를 지정합니다. 각 TPU 버전에서 지원되는 가속기 유형에 대한 자세한 내용은 TPU 버전을 참조하세요.
runtime-version
Cloud TPU 소프트웨어 버전입니다.

주문형 큐에 추가된 리소스의 기본 슬라이스 크기

주문형 할당량을 사용하는 경우 슬라이스 크기를 사용 중인 가속기 유형의 기본 한도보다 적게 요청해야 합니다. 기본 한도를 초과하는 요청은 시스템에서 거부됩니다.

다음 표에서는 TPU 유형과 관련된 기본 한도를 보여줍니다.

가속기 유형 기본 한도(TensorCore 수)
v2 128
v3 128
v4 384
v5 32

더 큰 슬라이스 크기가 필요하면 Cloud TPU 지원팀에 문의하여 추가 정보를 확인하세요.

예약된 할당량을 사용하여 큐에 추가된 리소스 요청

gcloud 명령어에 --reserved 플래그를 지정하거나 curl 요청에 guaranteed.reserved=true를 지정하여 예약된 할당량을 사용해 큐에 추가된 리소스를 요청할 수 있습니다. 예약된 할당량에 대한 자세한 내용은 할당량 유형을 참조하세요.

gcloud

gcloud alpha compute tpus queued-resources create your-queued-resource-id \
--node-id your-node-id \
--project your-project \
--zone us-central2-b \
--accelerator-type v4-8 \
--runtime-version tpu-vm-tf-2.16.1-pjrt \
--reserved

curl

curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{
'tpu': {
  'node_spec': {
    'parent': 'projects/your-project-number/locations/us-central2-b',
    'node_id': 'your-node-id',
    'node': {
      'accelerator_type': 'v4-8',
      'runtime_version': 'tpu-vm-tf-2.16.1-pjrt',
    }
  }
},
'guaranteed': {
  'reserved': true,
}
}" \
https://tpu.googleapis.com/v2alpha1/projects/your-project-id/locations/us-central2-b/queuedResources?queued_resource_id=your-queued-resource-id

명령어 매개변수 설명

queued-resource-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
node-id
큐에 추가된 리소스 요청이 할당될 때 생성되는 TPU의 사용자 할당 ID입니다.
project
Google Cloud 프로젝트.
zone
Cloud TPU를 생성하려는 영역입니다.
accelerator-type
가속기 유형은 만들려는 Cloud TPU의 버전과 크기를 지정합니다. 각 TPU 버전에서 지원되는 가속기 유형에 대한 자세한 내용은 TPU 버전을 참조하세요.
runtime-version
Cloud TPU 소프트웨어 버전입니다.
reserved
Cloud TPU 예약의 일부로 큐에 추가된 리소스를 요청할 때 이 플래그를 사용합니다.

큐에 추가된 선점형 리소스 요청

큐에 추가된 선점형 리소스를 요청할 수 있습니다. 선점형 리소스는 다른 워크로드에 추가 리소스가 필요한 경우 다른 워크로드에 할당할 수 있는 리소스입니다. 선점형 리소스는 비용이 낮으며 비선점형 요청에 비해 더 빠르게 리소스에 액세스할 수 있습니다. 선점형 할당량에 대한 자세한 내용은 할당량 유형을 참조하세요.

gcloud

gcloud alpha compute tpus queued-resources create your-queued-resource-id \
--node-id your-node-id \
--project your-project-id \
--zone us-central2-b \
--accelerator-type v4-8 \
--runtime-version tpu-vm-tf-2.16.1-pjrt \
--best-effort

curl

curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{
'tpu': {
  'node_spec': {
    'parent': 'projects/your-project-number/locations/us-central2-b',
    'node_id': 'your-node-id',
    'node': {
      'accelerator_type': 'v4-8',
      'runtime_version': 'tpu-vm-tf-2.16.1-pjrt',
    }
  }
},
'best_effort': {}
}" \
https://tpu.googleapis.com/v2alpha1/projects/your-project-id/locations/us-central2-b/queuedResources?queued_resource_id=your-queued-resource-id

명령어 매개변수 설명

queued-resource-request-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
node-id
요청에 응답해 생성된 TPU의 사용자 정의 ID입니다.
project
큐에 추가된 리소스가 할당된 프로젝트의 ID입니다.
zone
Cloud TPU를 생성하려는 영역입니다.
accelerator-type
가속기 유형은 만들려는 Cloud TPU의 버전과 크기를 지정합니다. 각 TPU 버전에서 지원되는 가속기 유형에 대한 자세한 내용은 TPU 버전을 참조하세요.
runtime-version
Cloud TPU 소프트웨어 버전입니다.
best-effort
큐에 추가된 리소스가 선점형임을 지정하는 불리언 플래그입니다.

큐에 추가된 리소스가 지정된 시간 이전 또는 이후에 할당되도록 요청

큐에 추가된 리소스 요청에 선택사항인 시작 시간, 종료 시간, 시작 기간 또는종료 기간을 지정할 수 있습니다. 시작 시간 또는 시작 기간은 요청을 채울 가장 이른 시간을 지정합니다. 지정된 종료 시간까지 또는 지정된 기간 내에 요청이 작성되지 않으면 요청이 만료됩니다. 요청이 만료된 후에도 큐에 남아 있지만 더 이상 할당할 수 없습니다.

시작 시간 또는 기간과 종료 시간 또는 기간을 지정하여 할당 간격을 지정할 수도 있습니다.

지원되는 타임스탬프 및 기간 형식 목록은 날짜/시간을 참조하세요.

지정된 기간 후에 큐에 추가된 리소스 요청

--valid-after-duration 플래그를 사용하여 이후에 리소스를 할당해야 하는 기간을 지정할 수 있습니다. 다음 예시에서는 v4-32를 6시간 후에 할당하도록 요청합니다.

gcloud

gcloud alpha compute tpus queued-resources create your-queued-resource-id \
--node-id your-node-id \
--project your-project-id \
--zone us-central2-b \
--accelerator-type v4-32 \
--runtime-version tpu-vm-tf-2.16.1-pod-pjrt \
--valid-after-duration 6h

curl

curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{
'tpu': {
  'node_spec': {
    'parent': 'projects/your-project-number/locations/us-central2-b',
    'node_id': 'your-node-id',
    'node': {
      'accelerator_type': 'v4-32',
      'runtime_version': 'tpu-vm-tf-2.16.1-pod-pjrt',
    }
  }
},
'queueing_policy': {
  'valid_after_duration': {
    'seconds': 21600
  }
}" \
https://tpu.googleapis.com/v2alpha1/projects/your-project-id/locations/us-central2-b/queuedResources?queued_resource_id=your-queued-resource-id

명령어 매개변수 설명

queued-resource-request-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
node-id
요청에 응답해 생성된 TPU의 사용자 정의 ID입니다.
project
큐에 추가된 리소스가 할당된 Google Cloud 프로젝트입니다.
zone
Cloud TPU를 생성하려는 영역입니다.
accelerator-type
가속기 유형은 만들려는 Cloud TPU의 버전과 크기를 지정합니다. 각 TPU 버전에서 지원되는 가속기 유형에 대한 자세한 내용은 TPU 버전을 참조하세요.
runtime-version
Cloud TPU 소프트웨어 버전입니다.
valid-after-duration
TPU를 프로비저닝하지 않아야 하는 기간입니다. 기간 형식에 대한 자세한 내용은 Google Cloud CLI topic datetime을 참조하세요.

지정된 기간 후에 만료되는 큐에 추가된 리소스 요청

--valid-until-duration 플래그를 사용하여 큐에 추가된 리소스 요청의 유효한 기간을 지정할 수 있습니다. 다음 예시에서는 6시간 동안 입력하지 않으면 만료되는 v4-32를 요청합니다.

gcloud

gcloud alpha compute tpus queued-resources create your-queued-resource-id \
--node-id your-node-id \
--project your-project-id \
--zone us-central2-b \
--accelerator-type v4-32 \
--runtime-version tpu-vm-tf-2.16.1-pod-pjrt \
--valid-until-duration 6h

curl

curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{
'tpu': {
  'node_spec': {
    'parent': 'projects/your-project-number/locations/us-central2-b',
    'node_id': 'your-node-id',
    'node': {
      'accelerator_type': 'v4-32',
      'runtime_version': 'tpu-vm-tf-2.16.1-pod-pjrt',
    }
  }
},
'queueing_policy': {
  'valid_until_duration': {
    'seconds': 21600
  }
}" \
https://tpu.googleapis.com/v2alpha1/projects/your-project-id/locations/us-central2-b/queuedResources?queued_resource_id=your-queued-resource-id

명령어 매개변수 설명

queued-resource-request-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
node-id
요청에 응답해 생성된 TPU의 사용자 정의 ID입니다.
project
큐에 추가된 리소스가 할당된 Google Cloud 프로젝트입니다.
zone
Cloud TPU를 생성하려는 영역입니다.
accelerator-type
가속기 유형은 만들려는 Cloud TPU의 버전과 크기를 지정합니다. 각 TPU 버전에서 지원되는 가속기 유형에 대한 자세한 내용은 TPU 버전을 참조하세요.
runtime-version
Cloud TPU 소프트웨어 버전입니다.
valid-until-duration
요청의 유효 기간입니다. 기간 형식에 대한 자세한 내용은 Google Cloud CLI topic datetime을 참조하세요.

지정된 시간 후에 큐에 추가된 리소스 요청

--valid-after-time 플래그를 사용하여 리소스를 할당해야 하는 시간을 지정할 수 있습니다.

다음 명령어는 2022년 12월 14일 오전 9시 이후에 런타임 버전 tpu-vm-tf-2.16.1-pjrt이 할당된 v4-4096 TPU를 요청합니다.

gcloud

gcloud alpha compute tpus queued-resources create your-queued-resource-id \
--node-id your-node-id \
--project your-project-id \
--zone us-central2-b \
--accelerator-type v4-4096 \
--runtime-version tpu-vm-tf-2.16.1-pod-pjrt \
--valid-after-time 2022-12-14T09:00:00Z

curl

curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{
'tpu': {
  'node_spec': {
    'parent': 'projects/your-project-number/locations/us-central2-b',
    'node_id': 'your-node-id',
    'node': {
      'accelerator_type': 'v4-4096',
      'runtime_version': 'tpu-vm-tf-2.16.1-pod-pjrt',
    }
  }
},
'queueing_policy': {
  'valid_after_time': {
    'seconds': 2022-12-14T09:00:00Z
  }
}
}" \
https://tpu.googleapis.com/v2alpha1/projects/your-project-id/locations/us-central2-b/queuedResources?queued_resource_id=your-queued-resource-id

명령어 매개변수 설명

queued-resource-request-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
node-id
요청에 응답해 생성된 TPU의 사용자 정의 ID입니다.
project
큐에 추가된 리소스가 할당된 Google Cloud 프로젝트입니다.
zone
Cloud TPU를 생성하려는 영역입니다.
accelerator-type
가속기 유형은 만들려는 Cloud TPU의 버전과 크기를 지정합니다. 각 TPU 버전에서 지원되는 가속기 유형에 대한 자세한 내용은 TPU 버전을 참조하세요.
runtime-version
Cloud TPU 소프트웨어 버전입니다.
valid-after-time
이후에는 리소스를 할당해야 합니다. 기간 형식에 대한 자세한 내용은 Google Cloud CLI topic datetime을 참조하세요.

지정된 시간 전에 큐에 추가된 리소스 요청

--valid-until-time 플래그를 사용하여 이전에 리소스를 할당해야 하는 시간을 지정할 수 있습니다.

다음 명령어는 늦어도 2022년 12월 14일 오전 9시까지는 런타임 버전 tpu-vm-tf-2.10.0-pod로 v4-4096 TPU 노드를 만들도록 요청합니다.

gcloud

gcloud alpha compute tpus queued-resources create your-queued-resource-id \
--node-id your-node-id \
--project your-project-id \
--zone us-central2-b \
--accelerator-type v4-4096 \
--runtime-version tpu-vm-tf-2.16.1-pod-pjrt \
--valid-until-time 2022-12-14T09:00:00Z

curl

curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{
'tpu': {
  'node_spec': {
    'parent': 'projects/your-project-number/locations/us-central2-b',
    'node_id': 'your-node-id',
    'node': {
      'accelerator_type': 'v4-4096',
      'runtime_version': 'tpu-vm-tf-2.16.1-pod-pjrt',
    }
  }
},
'queueing_policy': {
  'valid_until_time': {
    'seconds': 1655197200
  }
}
}" \
https://tpu.googleapis.com/v2alpha1/projects/your-project-id/locations/us-central2-b/queuedResources?queued_resource_id=your-queued-resource-id

명령어 매개변수 설명

queued-resource-request-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
node-id
요청에 응답해 생성된 TPU의 사용자 정의 ID입니다.
project
큐에 추가된 리소스가 할당된 프로젝트의 ID입니다.
zone
Cloud TPU를 생성하려는 영역입니다.
accelerator-type
가속기 유형은 만들려는 Cloud TPU의 버전과 크기를 지정합니다. 각 TPU 버전에서 지원되는 가속기 유형에 대한 자세한 내용은 TPU 버전을 참조하세요.
runtime-version
Cloud TPU 소프트웨어 버전입니다.
valid-until-time
이시간이 지나면 요청이 취소됩니다. 기간 형식에 대한 자세한 내용은 Google Cloud CLI topic datetime을 참조하세요.

지정된 간격 내에 할당될 큐에 추가된 리소스 요청

하나의 플래그가 할당 간격의 시작을 지정하고 다른 플래그가 할당 간격을 끝을 지정하면 --valid-after-time, --valid-after-duration, --valid-until-duration, --valid-until-time 플래그의 쌍을 사용하여 할당 간격을 지정할 수 있습니다.

다음 명령어는 현재 시간으로부터 5시간 30분 후에 늦어도 2022년 12월 14일 오전 9시까지는 v4-32를 만들도록 요청합니다.

gcloud

gcloud alpha compute tpus queued-resources create your-queued-resource-id \
--node-id your-node-id \
--project your-project-id \
--zone us-central2-b \
--accelerator-type v4-32 \
--runtime-version tpu-vm-tf-2.16.1-pod-pjrt \
--valid-after-duration 5h30m \
--valid-until-time 2022-12-14T09:00:00Z

curl

curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{
'tpu': {
  'node_spec': {
    'parent': 'projects/your-project-number/locations/us-central2-b',
    'node_id': 'your-node-id',
    'node': {
      'accelerator_type': 'v4-32',
      'runtime_version': 'tpu-vm-tf-2.16.1-pod-pjrt',
    }
  }
},
'queueing_policy': {
  'validInterval': {
    'startTime': '2022-12-10T14:30:00Z',
    'endTime': '2022-12-14T09:00:00Z'
  }
},
}" \
https://tpu.googleapis.com/v2alpha1/projects/your-project-id/locations/us-central2-b/queuedResources?queued_resource_id=your-queued-resource-id

명령어 플래그 설명

queued-resource-request-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
node-id
요청에 응답해 생성된 TPU의 사용자 정의 ID입니다.
project
큐에 추가된 리소스가 할당된 프로젝트의 ID입니다.
zone
Cloud TPU를 생성하려는 영역입니다.
accelerator-type
가속기 유형은 만들려는 Cloud TPU의 버전과 크기를 지정합니다. 각 TPU 버전에서 지원되는 가속기 유형에 대한 자세한 내용은 TPU 버전을 참조하세요.
runtime-version
Cloud TPU 소프트웨어 버전입니다.
valid-until-timw
이시간이 지나면 요청이 취소됩니다. 기간 형식에 대한 자세한 내용은 Google Cloud CLI topic datetime을 참조하세요.
valid-until-duration
요청의 유효 기간입니다. 기간 형식에 대한 자세한 내용은 Google Cloud CLI topic datetime을 참조하세요.

시작 스크립트로 큐에 추가된 리소스 요청

큐에 추가된 리소스는 프로비저닝 후 실행할 스크립트를 지정할 수 있습니다. gcloud 명령어를 사용할 때는 --metadata 또는 --metadata-from-file 플래그를 사용하여 각각 스크립트 명령어나 스크립트 코드가 포함된 파일을 지정할 수 있습니다. curl을 사용하는 경우 JSON 콘텐츠에 스크립트 코드를 포함해야 합니다. 다음 예시에서는 startup-script.sh에 포함된 스크립트를 실행할 큐에 추가된 리소스 요청을 만듭니다. curl 예시에서는 JSON 본문의 인라인 스크립트를 보여줍니다.

gcloud

gcloud alpha compute tpus queued-resources create your-queued-resource-id \
--node-id your-node-id \
--project your-project \
--zone us-central2-b \
--accelerator-type v4-8 \
--runtime-version tpu-vm-tf-2.12.0 \
--reserved \
--metadata-from-file='startup-script=startup-script.sh'

curl

curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{
tpu: {
    node_spec: {
      parent: 'projects/your-project-number/locations/us-central2-b',
      node_id: 'your-node-id',
      node: {
          accelerator_type: 'v2-8',
          runtime_version: 'tpu-vm-tf-2.16.1-pjrt',
          metadata: {
              "startup-script": "#! /bin/bash\npwd > /tmp/out.txt\nwhoami >> /tmp/out.txt"
          }
      }
    }
},
'queueing_policy': {
  'validInterval': {
    'startTime': '2022-12-10T14:30:00Z',
    'endTime': '2022-12-14T09:00:00Z'
  }
},
}" \
https://tpu.googleapis.com/v2alpha1/projects/your-project-id/locations/us-central2-b/queuedResources?queued_resource_id=your-queued-resource-id

명령어 플래그 설명

queued-resource-request-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
node-id
요청에 응답해 생성된 TPU의 사용자 정의 ID입니다.
project
큐에 추가된 리소스가 할당된 프로젝트의 ID입니다.
zone
Cloud TPU를 생성하려는 영역입니다.
accelerator-type
가속기 유형은 만들려는 Cloud TPU의 버전과 크기를 지정합니다. 각 TPU 버전에서 지원되는 가속기 유형에 대한 자세한 내용은 TPU 버전을 참조하세요.
runtime-version
Cloud TPU 소프트웨어 버전입니다.
validInterval
요청이 유효하며 요청이 취소된 후 경과하는 시간입니다. 기간 형식에 대한 자세한 내용은 Google Cloud CLI 주제 시간을 참조하세요.
metadata-from-file
메타데이터가 포함된 파일을 지정합니다. 메타데이터 파일에 정규화된 경로를 지정하지 않으면 명령어에서 이 파일이 현재 디렉터리에 있다고 가정합니다. 이 예시의 파일에는 큐에 추가된 리소스가 프로비저닝될 때 실행되는 시작 스크립트가 포함됩니다.
metadata
요청에 대한 메타데이터를 지정합니다. 이 예시에서 메타데이터는 큐에 추가된 리소스가 프로비저닝될 때 실행되는 시작 스크립트 명령어입니다.

지정된 네트워크 및 서브네트워크를 사용한 큐에 추가된 리소스 요청

TPU를 연결할 네트워크 및 서브네트워크를 지정하여 큐에 추가된 리소스를 요청할 수 있습니다.

gcloud

gcloud alpha compute tpus queued-resources create your-queued-resource-id \
--node-id your-node-id \
--project your-project \
--zone us-central2-b \
--accelerator-type v4-8 \
--runtime-version tpu-vm-tf-2.16.1-pjrt \
--network network-name \
--subnetwork subnetwork-name

curl

curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{
'tpu': {
  'node_spec': {
    'parent': 'projects/your-project-number/locations/us-central2-b',
    'node_id': 'your-node-id',
    'node': {
      'accelerator_type': 'v4-8',
      'runtime_version': 'tpu-vm-tf-2.16.1-pjrt',
       'network_config': {
        'network': 'network-name',
        'subnetwork': 'subnetwork-name',
        'enable_external_ips': true
    }
  }
},
'guaranteed': {
  'reserved': true,
}
}" \
https://tpu.googleapis.com/v2alpha1/projects/your-project-id/locations/us-central2-b/queuedResources?queued_resource_id=your-queued-resource-id

명령어 매개변수 설명

queued-resource-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
node-id
큐에 추가된 리소스 요청이 할당될 때 생성되는 TPU의 사용자 할당 ID입니다.
project
Google Cloud 프로젝트.
zone
Cloud TPU를 생성하려는 영역입니다.
accelerator-type
가속기 유형은 만들려는 Cloud TPU의 버전과 크기를 지정합니다. 각 TPU 버전에서 지원되는 가속기 유형에 대한 자세한 내용은 TPU 버전을 참조하세요.
runtime-version
Cloud TPU 소프트웨어 버전입니다.
reserved
Cloud TPU 예약의 일부로 큐에 추가된 리소스를 요청할 때 이 플래그를 사용합니다.
network
큐에 추가된 리소스가 포함될 네트워크입니다.
subnetwork
큐에 추가된 리소스가 포함될 서브네트워크입니다.

큐에 추가된 리소스 요청 삭제

--force 플래그를 queued-resource delete 명령어로 전달하여 큐에 추가된 리소스 요청 및 해당 요청으로 생성된 TPU VM을 삭제할 수 있습니다. 그렇지 않으면 큐에 추가된 리소스 요청을 삭제하기 전에 TPU VM을 삭제해야 합니다. TPU VM을 삭제하면 큐에 추가된 리소스 요청이 SUSPENDED 상태로 전환된 후 큐에 추가된 리소스 요청이 삭제될 수 있습니다.

다음 명령어는 'us-central2-b' 영역의 'my-project' 프로젝트에서 'my-queued-resource'라는 큐에 추가된 리소스 요청을 삭제합니다. --force 플래그를 사용하여 TPU VM과 큐에 추가된 리소스 요청을 모두 삭제합니다.

gcloud

gcloud compute tpus queued-resources delete my-queued-resource \
--project my-project \
--zone us-central2-b \
--force \
--async

curl

curl -X DELETE -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://tpu.googleapis.com/v2/projects/my-project/locations/us-central2-b/queuedResources/my-queued-resource?force=true

명령어 플래그 설명

queued-resource-request-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
project
큐에 추가된 리소스가 할당된 Google Cloud 프로젝트입니다.
zone
삭제할 Cloud TPU의 영역입니다.
force
TPU VM과 큐에 추가된 리소스 요청을 모두 삭제합니다.

다음 명령어는 'us-central2-b' 영역의 'my-project' 프로젝트에서 'my-queued-resource'라는 큐에 추가된 리소스 요청을 삭제합니다.

gcloud

gcloud compute tpus queued-resources delete your-queued-resource-id \
--project your-project-id \
--zone us-central2-b

curl

curl -X DELETE -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://tpu.googleapis.com/v2/projects/your-project-id/locations/us-central2-b/queuedResources/your-queued-resource-id

명령어 플래그 설명

queued-resource-request-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
project
큐에 추가된 리소스가 할당된 Google Cloud 프로젝트입니다.
zone
Cloud TPU를 생성하려는 영역입니다.

큐에 추가된 리소스 요청에 대한 상태 및 진단 정보 검색

큐에 추가된 리소스 요청에 대한 상태 및 진단 정보를 검색합니다.

gcloud

gcloud compute tpus queued-resources describe queued-resource-request-id \
--project your-project-id \
--zone us-central2-b

curl

curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://tpu.googleapis.com/v2/projects/your-project-id/locations/us-central2-b/queuedResources/your-queued-resource-id

명령어 플래그 설명

queued-resource-request-id
큐에 추가된 리소스 요청의 사용자 할당 ID입니다.
project
큐에 추가된 리소스가 할당된 프로젝트의 ID입니다.
zone
Cloud TPU를 생성하려는 영역입니다.

요청이 실패하면 응답에 오류 정보가 포함됩니다. 리소스를 기다리는 요청의 경우 출력이 다음과 비슷하게 표시됩니다.

name: projects/your-project-id/locations/us-central2-b/queuedResources/your-queued-resource-id
state:
  state: WAITING_FOR_RESOURCES
tpu:
  nodeSpec:
  - node:
      acceleratorType: v4-8
      bootDisk: {}
      networkConfig:
        enableExternalIps: true
      queuedResource: projects/your-project-number/locations/us-central2-b/queuedResources/your-queued-resource-id
      runtimeVersion: tpu-vm-tf-2.10.0
      schedulingConfig: {}
      serviceAccount: {}
      shieldedInstanceConfig: {}
      useTpuVm: true
    nodeId: your-node-id
    parent: projects/your-project-number/locations/us-central2-b

프로젝트의 큐에 추가된 리소스 요청 나열

다음 명령어는 큐에 추가된 리소스 요청을 'your-project-id' 프로젝트에 나열합니다.

gcloud

gcloud compute tpus queued-resources list --project your-project-id \
--zone us-central2-b

curl

curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://tpu.googleapis.com/v2/projects/your-project-id/locations/us-central2-b/queuedResources

명령어 플래그 설명

project
큐에 추가된 리소스가 할당된 Google Cloud 프로젝트입니다.
zone
Cloud TPU를 생성하려는 영역입니다.