피처스토어 관리

피처스토어를 생성, 나열, 설명, 업데이트, 삭제하는 방법을 알아봅니다. 피처스토어는 항목 유형, 특성, 특성 값의 최상위 컨테이너입니다.

온라인 및 오프라인 스토리지

Vertex AI Feature Store(기존)는 가격 책정이 다른 온라인 스토리지오프라인 스토리지로 분류된 두 가지 스토리지 방법을 사용합니다. 모든 피처스토어에는 오프라인 스토리지와 선택 사항인 온라인 스토리지가 있습니다.

온라인 스토리지는 특성의 최신 타임스탬프 값을 유지하여 온라인 제공 요청을 효율적으로 처리합니다. API를 사용하여 가져오기 작업을 실행할 때 데이터가 온라인 스토리지에 기록되는 경우에는 작업을 제어할 수 있습니다. 온라인 스토리지를 건너뛰면 온라인 제공 노드의 부하가 방지됩니다. 예를 들어 백필 작업을 실행하는 경우 온라인 스토리지에 대한 쓰기를 사용 중지하고 오프라인 스토리지에만 쓰기를 수행할 수 있습니다. 자세한 내용은 API 참조에서 disableOnlineServing 플래그를 확인하세요.

Vertex AI Feature Store(기존)는 데이터가 보관 한도에 도달하거나 사용자가 삭제할 때까지 오프라인 스토리지를 사용하여 데이터를 저장합니다. 오프라인 저장소에 무제한 데이터를 저장할 수 있습니다. 보관할 데이터의 양을 관리하여 오프라인 스토리지 비용을 제어할 수 있습니다. 또한 피처스토어의 기본 온라인 저장소 데이터 보관 한도와 엔티티 유형의 오프라인 데이터 보관 한도를 재정의할 수 있습니다. Vertex AI Feature Store(기존) 할당량 및 한도를 자세히 알아봅니다.

Google Cloud 콘솔을 사용하여 현재 사용 중인 온라인 및 오프라인 스토리지의 용량을 확인하세요. 피처스토어의 총 온라인 스토리지총 오프라인 스토리지 모니터링 측정항목을 열람하여 사용량을 확인합니다.

온라인 제공 노드

온라인 제공 노드는 지연 시간이 짧은 온라인 제공을 위해 특성 값을 저장하고 제공하는 데 사용되는 컴퓨팅 리소스를 제공합니다. 이러한 노드는 데이터를 제공하지 않는 경우에도 항상 실행됩니다. 요금은 노드 시간별로 부과됩니다.

온라인 제공 노드의 스토리지 한도는 노드당 5TB입니다. Vertex AI Feature Store(기존) 할당량 및 한도를 자세히 알아봅니다.

필요한 온라인 제공 노드 수는 다음 두 가지 요소에 정비례합니다.

  • 피처스토어가 수신하는 온라인 제공 요청 수(초당 쿼리 수)
  • 온라인 스토리지에 쓰는 가져오기 작업 수

두 요소 모두 노드의 CPU 사용률 및 성능에 영향을 줍니다. Google Cloud 콘솔에서 다음 측정항목을 확인하세요.

  • 초당 쿼리 수: 피처스토어에 대한 초당 쿼리 수
  • 노드 수: 온라인 제공 노드 수
  • CPU 사용률: 노드의 CPU 사용률

CPU 사용률이 지속적으로 높으면 피처스토어의 온라인 제공 노드 수를 늘려보세요.

온라인 서빙 노드의 성능 테스트

실시간 특성 서빙에 대한 온라인 제공 노드의 성능을 테스트할 수 있습니다. 이렇게 하면 피처스토어에 미리 정의된 QPS 또는 지연 시간 기준 내에 수행할 수 있는 충분한 머신 리소스가 있는지 확인할 수 있습니다. QPS, 지연 시간, API와 같은 여러 벤치마킹 매개변수를 기반으로 이러한 테스트를 수행할 수 있습니다. 온라인 제공 노드의 성능을 테스트하는 가이드라인 및 권장사항은 Vertex AI Feature Store(기존) 권장사항온라인 제공 노드의 성능 테스트를 참조하세요.

또는 Vertex AI 벤치마크 오픈소스 도구를 사용해서 특성 저장소 리소스의 성능 평가를 위해 로드 테스트를 수행할 수 있습니다. Vertex AI 벤치마크 오픈소스 도구는 Python 명령줄 도구 및 자바 작업자로 구성됩니다.

확장 옵션

다음 옵션 사이를 전환하여 온라인 제공 노드 수를 구성할 수 있습니다.

  • 자동 확장

    자동 확장을 선택하면 피처스토어가 CPU 사용률에 따라 노드 수를 자동으로 변경합니다. 자동 확장 기능은 트래픽 패턴을 검토하여 트래픽이 증가할 때 노드를 추가하고 트래픽이 감소할 때 노드를 삭제하여 비용을 유지하고 최적화합니다.

    자동 확장은 점진적인 증가 및 감소가 발생하는 환경의 트래픽 패턴에 적합합니다. 자주 부하 변동이 발생하는 트래픽 패턴에 Vertex AI Feature Store(기존)를 광범위하게 사용하는 경우 자동 확장을 사용하여 비용 효율성을 개선하세요.

  • 고정 노드 수 할당

    고정 노드 수를 할당하면 Vertex AI Feature Store(기존)는 트래픽 패턴에 관계없이 일관된 노드 수를 유지합니다. 고정 노드 수는 비용을 예측할 수 있으며 트래픽을 처리할 수 있는 충분한 노드가 있을 때 노드가 제대로 작동합니다. 고정된 노드 수를 수동으로 변경하여 트래픽 패턴의 변경사항을 처리할 수 있습니다.

자동 확장에 대한 추가 고려사항

자동 확장을 선택할 경우 다음의 4가지 사항을 고려해야 합니다.

  • 온라인 제공 노드를 추가한 후에 온라인 상점은 데이터를 재조정할 시간이 필요합니다. 성능이 대폭 향상된 경우 부하 상태에서 최대 20분이 걸릴 수 있습니다. 따라서 노드 수를 확장하면 짧은 시간 동안 트래픽 버스트가 발생하는 경우 도움이 되지 않을 수 있습니다. 이러한 제한은 수동 확장과 자동 확장 모두에서 적용됩니다.

  • 온라인 제공 노드 없이 피처스토어에 온라인 제공 요청을 제출하면 작업이 오류를 반환합니다.

피처스토어에서 온라인 제공 사용 중지

온라인 서빙이 필요하지 않고 온라인 서빙 노드가 변경되지 않도록 방지하려면 온라인 서빙 노드 수를 0으로 설정합니다. 피처스토어에서 온라인 제공을 사용 중지하려면 다음 구성을 설정합니다.

  1. 자동 확장을 사용하는 경우 scaling 매개변수를 삭제합니다.

  2. 고정된 온라인 제공 노드 수를 0으로 설정합니다.

피처스토어를 만드는 방법에 대한 자세한 내용은 피처스토어 만들기를 참조하세요. 기존 피처스토어의 구성을 수정하는 방법에 대한 자세한 내용은 피처스토어 업데이트를 참조하세요.

온라인 서빙 노드 수를 0으로 설정하면 데이터를 포함한 전체 온라인 저장소가 삭제됩니다. 온라인 저장소를 일시적으로 사용 중지하고 복원하려면 삭제된 데이터를 다시 가져와야 합니다.

예를 들어 피처스토어의 온라인 제공 노드 수를 0으로 설정한 다음 노드 수를 1 이상으로 설정하여 온라인 제공 노드를 프로비저닝하면 Vertex AI Feature Store(기존)가 삭제된 피처 데이터를 온라인 저장소로 마이그레이션하지 않습니다. 온라인 저장소를 다시 채우려면 데이터를 다시 가져와야 합니다. 데이터를 다시 가져오는 한 가지 방법은 온라인 서빙 노드를 중지하기 전에 이전 데이터를 내보낸 후 노드를 프로비저닝한 다음 내보낸 데이터를 가져오는 것입니다.

온라인 서빙 노드를 프로비저닝할 때는 작업이 완료될 때까지 기다린 후에 새 데이터를 가져와야 합니다. 진행 중인 가져오기 작업은 온라인 서빙 노드 프로비저닝이 완료된 후에만 재개됩니다.

온라인 제공 노드 없이 피처스토어에 온라인 제공 요청을 제출하면 요청이 오류를 반환합니다.

피처스토어 만들기

항목 유형 및 특성을 포함하는 피처스토어 리소스를 만드세요. 피처스토어의 위치는 소스 데이터와 동일한 위치에 있어야 합니다. 예를 들어 피처스토어가 us-central,에 있으면 us-central1 또는 미국 멀티 리전 위치에 있는 Cloud Storage 버킷의 파일에서 데이터를 가져올 수 있지만 이중 리전 버킷의 소스 데이터는 지원되지 않습니다. 마찬가지로 BigQuery의 경우 us-central1 또는 미국 멀티 리전 위치에 있는 테이블의 데이터를 가져올 수 있습니다. 자세한 내용은 소스 데이터 요구사항을 참조하세요.

Vertex AI Feature Store(기존) 사용 가능 여부는 위치에 따라 다를 수 있습니다. 자세한 내용은 기능 제공 여부를 참조하세요.

웹 UI

피처스토어가 선택한 리전에 대해 Google Cloud 프로젝트에 아직 생성되지 않았으면 Google Cloud 콘솔을 사용하여 피처스토어를 만들 수 있습니다. 피처스토어가 프로젝트 및 리전에 대해 이미 있으면 다른 방법을 사용합니다.

Google Cloud 콘솔을 사용하여 피처스토어를 만들려면 다음 안내를 따르세요.

  1. Google Cloud 콘솔의 Vertex AI 섹션에서 특성 페이지로 이동합니다.

    특성 페이지로 이동

  2. 피처스토어 만들기를 클릭합니다.
  3. 피처스토어 이름을 지정합니다.
  4. 피처스토어에 대해 온라인 제공을 켜려면 온라인 제공 켜기 전환을 클릭하고 확장 옵션을 설정합니다.
    온라인 제공 및 확장 옵션에 대한 자세한 내용은 온라인 제공 노드를 참조하세요
  5. 만들기를 클릭합니다.

Terraform

다음 샘플은 google_vertex_ai_featurestore Terraform 리소스를 사용하여 고정된 노드 수가 있는 피처스토어를 만듭니다. 피처스토어의 이름은 featurestore_xxxxxxxx입니다. 여기서 xxxxxxxx는 무작위로 생성된 영숫자 식별자입니다.

Terraform 구성을 적용하거나 삭제하는 방법은 기본 Terraform 명령어를 참조하세요.

# Featurestore name must be unique for the project
resource "random_id" "featurestore_name_suffix" {
  byte_length = 8
}

resource "google_vertex_ai_featurestore" "main" {
  name   = "featurestore_${random_id.featurestore_name_suffix.hex}"
  region = "us-central1"
  labels = {
    environment = "testing"
  }

  online_serving_config {
    fixed_node_count = 1
  }

  force_destroy = true
}

REST

피처스토어를 만들려면 featurestores.create 메서드를 사용하여 POST 요청을 전송하세요.

다음 샘플에서는 고정된 노드 수가 1인 피처스토어를 만듭니다. 노드 수는 온라인 서빙 노드 수를 지정하며 이는 피처스토어에서 처리할 수 있는 온라인 서빙 요청 수에 영향을 줍니다. 노드 수가 수신 요청 수를 지원할 수 없으면 지연 시간이 증가할 수 있습니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • LOCATION_ID: 피처스토어가 생성되는 리전. 예를 들면 us-central1입니다.
  • PROJECT_ID: 프로젝트 ID
  • FEATURESTORE_ID: 피처스토어의 ID

HTTP 메서드 및 URL:

POST http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores?featurestoreId=FEATURESTORE_ID

JSON 요청 본문:

{
  "online_serving_config": {
    "fixed_node_count": 1
  },
  "labels": {
    "environment": "testing"
  }
}

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores?featurestoreId=FEATURESTORE_ID"

PowerShell

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores?featurestoreId=FEATURESTORE_ID" | Select-Object -Expand Content

다음과 비슷한 출력이 표시됩니다. 응답의 OPERATION_ID를 사용하여 작업 상태를 가져올 수 있습니다.

{
"name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.CreateFeaturestoreOperationMetadata",
    "genericMetadata": {
      "createTime": "2021-02-26T00:44:40.722474Z",
      "updateTime": "2021-02-26T00:44:40.722474Z"
    }
  }
}

Python

Python용 Vertex AI SDK를 설치하거나 업데이트하는 방법은 Python용 Vertex AI SDK 설치를 참조하세요. 자세한 내용은 Python API 참고 문서를 확인하세요.

from google.cloud import aiplatform

def create_featurestore_sample(
    project: str,
    location: str,
    featurestore_id: str,
    online_store_fixed_node_count: int = 1,
    sync: bool = True,
):

    aiplatform.init(project=project, location=location)

    fs = aiplatform.Featurestore.create(
        featurestore_id=featurestore_id,
        online_store_fixed_node_count=online_store_fixed_node_count,
        sync=sync,
    )

    fs.wait()

    return fs

Python

Vertex AI 클라이언트 라이브러리는 Python용 Vertex AI SDK를 설치할 때 포함됩니다. Python용 Vertex AI SDK를 설치하는 방법은 Python용 Vertex AI SDK 설치를 참조하세요. 자세한 내용은 Python용 Vertex AI SDK API 참고 문서를 확인하세요.

from google.cloud import aiplatform

def create_featurestore_sample(
    project: str,
    featurestore_id: str,
    fixed_node_count: int = 1,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
    timeout: int = 1200,
):
    # The AI Platform services require regional API endpoints, which need to be
    # in the same region or multi-region overlap with the Feature Store location.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.FeaturestoreServiceClient(client_options=client_options)
    parent = f"projects/{project}/locations/{location}"
    create_featurestore_request = aiplatform.gapic.CreateFeaturestoreRequest(
        parent=parent,
        featurestore_id=featurestore_id,
        featurestore=aiplatform.gapic.Featurestore(
            online_serving_config=aiplatform.gapic.Featurestore.OnlineServingConfig(
                fixed_node_count=fixed_node_count,
            ),
        ),
    )
    lro_response = client.create_featurestore(request=create_featurestore_request)
    print("Long running operation:", lro_response.operation.name)
    create_featurestore_response = lro_response.result(timeout=timeout)
    print("create_featurestore_response:", create_featurestore_response)

Java

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Java 설정 안내를 따르세요. 자세한 내용은 Vertex AI Java API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.aiplatform.v1.CreateFeaturestoreOperationMetadata;
import com.google.cloud.aiplatform.v1.CreateFeaturestoreRequest;
import com.google.cloud.aiplatform.v1.Featurestore;
import com.google.cloud.aiplatform.v1.Featurestore.OnlineServingConfig;
import com.google.cloud.aiplatform.v1.Featurestore.OnlineServingConfig.Scaling;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings;
import com.google.cloud.aiplatform.v1.LocationName;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class CreateFeaturestoreSample {

  public static void main(String[] args)
      throws IOException, InterruptedException, ExecutionException, TimeoutException {
    // TODO(developer): Replace these variables before running the sample.
    String project = "YOUR_PROJECT_ID";
    String featurestoreId = "YOUR_FEATURESTORE_ID";
    int minNodeCount = 1;
    int maxNodeCount = 5;
    String location = "us-central1";
    String endpoint = "us-central1-aiplatform.googleapis.com:443";
    int timeout = 900;
    createFeaturestoreSample(
        project, featurestoreId, minNodeCount, maxNodeCount, location, endpoint, timeout);
  }

  static void createFeaturestoreSample(
      String project,
      String featurestoreId,
      int minNodeCount,
      int maxNodeCount,
      String location,
      String endpoint,
      int timeout)
      throws IOException, InterruptedException, ExecutionException, TimeoutException {

    FeaturestoreServiceSettings featurestoreServiceSettings =
        FeaturestoreServiceSettings.newBuilder().setEndpoint(endpoint).build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (FeaturestoreServiceClient featurestoreServiceClient =
        FeaturestoreServiceClient.create(featurestoreServiceSettings)) {

      OnlineServingConfig.Builder builderValue =
          OnlineServingConfig.newBuilder()
              .setScaling(
                  Scaling.newBuilder().setMinNodeCount(minNodeCount).setMaxNodeCount(maxNodeCount));
      Featurestore featurestore =
          Featurestore.newBuilder().setOnlineServingConfig(builderValue).build();
      String parent = LocationName.of(project, location).toString();

      CreateFeaturestoreRequest createFeaturestoreRequest =
          CreateFeaturestoreRequest.newBuilder()
              .setParent(parent)
              .setFeaturestore(featurestore)
              .setFeaturestoreId(featurestoreId)
              .build();

      OperationFuture<Featurestore, CreateFeaturestoreOperationMetadata> featurestoreFuture =
          featurestoreServiceClient.createFeaturestoreAsync(createFeaturestoreRequest);
      System.out.format(
          "Operation name: %s%n", featurestoreFuture.getInitialFuture().get().getName());
      System.out.println("Waiting for operation to finish...");
      Featurestore featurestoreResponse = featurestoreFuture.get(timeout, TimeUnit.SECONDS);
      System.out.println("Create Featurestore Response");
      System.out.format("Name: %s%n", featurestoreResponse.getName());
    }
  }
}

Node.js

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Node.js 설정 안내를 따르세요. 자세한 내용은 Vertex AI Node.js API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

/**
 * TODO(developer): Uncomment these variables before running the sample.\
 * (Not necessary if passing values as arguments)
 */

// const project = 'YOUR_PROJECT_ID';
// const featurestoreId = 'YOUR_FEATURESTORE_ID';
// const minNodeCount = <MINIMUM_NO_OF_NODES>;
// const maxNodeCount = <MAXIMUM_NO_OF_NODES>;
// const location = 'YOUR_PROJECT_LOCATION';
// const apiEndpoint = 'YOUR_API_ENDPOINT';
// const timeout = <TIMEOUT_IN_MILLI_SECONDS>;

// Imports the Google Cloud Featurestore Service Client library
const {FeaturestoreServiceClient} =
  require('@google-cloud/aiplatform').v1beta1;

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: apiEndpoint,
};

// Instantiates a client
const featurestoreServiceClient = new FeaturestoreServiceClient(
  clientOptions
);

async function createFeaturestore() {
  // Configure the parent resource
  const parent = `projects/${project}/locations/${location}`;

  const featurestore = {
    onlineServingConfig: {
      scaling: {
        minNodeCount: minNodeCount,
        maxNodeCount: maxNodeCount,
      },
    },
  };

  const request = {
    parent: parent,
    featurestore: featurestore,
    featurestoreId: featurestoreId,
  };

  // Create Featurestore request
  const [operation] = await featurestoreServiceClient.createFeaturestore(
    request,
    {timeout: Number(timeout)}
  );
  const [response] = await operation.promise();

  console.log('Create featurestore response');
  console.log(`Name : ${response.name}`);
  console.log('Raw response:');
  console.log(JSON.stringify(response, null, 2));
}
createFeaturestore();

CMEK를 사용하는 피처스토어 만들기

시작하기 전, 기존 CMEK(고객 관리 암호화 키)가 없으면 Cloud Key Management Service를 사용하여 고객 관리 암호화 키를 구성하고 권한을 설정합니다. 다음 샘플은 CMEK 키를 사용하는 피처스토어를 만듭니다.

Vertex AI가 연결된 CMEK 키에 대한 권한을 잃으면 이 키로 암호화된 피처스토어 내의 리소스와 값은 Vertex AI가 해당 키를 다시 사용할 수 있을 때까지 액세스할 수 없게 됩니다.

30일 후에도 Vertex AI가 CMEK 키에 액세스할 수 없는 경우 해당 키로 암호화된 모든 피처스토어를 Vertex AI에서 삭제합니다. 새 피처스토어를 만들 때 해당 피처스토어 이름을 재사용할 수 없습니다.

웹 UI

다른 메서드를 사용합니다. Google Cloud 콘솔에서는 피처스토어를 만들 수 없습니다.

REST

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • LOCATION_ID: 피처스토어가 생성되는 리전. 예를 들면 us-central1입니다.
  • PROJECT_ID: 프로젝트 ID
  • FEATURESTORE_ID: 피처스토어의 ID
  • CMEK_PROJECT: CMEK를 포함하는 프로젝트 ID 또는 프로젝트 번호
  • KEY_RING: 암호화 키가 설정된 Cloud Key Management Service 키링의 이름
  • KEY_NAME: 사용할 암호화 키의 이름

HTTP 메서드 및 URL:

POST http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores?featurestoreId=FEATURESTORE_ID

JSON 요청 본문:

{
  "online_serving_config": {
    "fixed_node_count": 1
  },
  "encryption_spec":{
    "kms_key_name": "projects/CMEK_PROJECT/locations/LOCATION_ID/keyRings/KEY_RING/cryptoKeys/KEY_NAME"
  }
}

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores?featurestoreId=FEATURESTORE_ID"

PowerShell

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores?featurestoreId=FEATURESTORE_ID" | Select-Object -Expand Content

다음과 비슷한 출력이 표시됩니다. 응답의 OPERATION_ID를 사용하여 작업 상태를 가져올 수 있습니다.

{
"name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.CreateFeaturestoreOperationMetadata",
    "genericMetadata": {
      "createTime": "2021-02-26T00:44:40.722474Z",
      "updateTime": "2021-02-26T00:44:40.722474Z"
    }
  }
}

피처스토어 나열

프로젝트의 모든 피처스토어를 나열합니다.

웹 UI

  1. Google Cloud 콘솔의 Vertex AI 섹션에서 특성 페이지로 이동합니다.

    특성 페이지로 이동

  2. 리전 드롭다운 목록에서 리전을 선택합니다.
  3. 특성 테이블에서 피처스토어 열을 보고 선택한 리전의 프로젝트에 있는 피처스토어를 확인합니다.

REST

프로젝트의 특정 리전에 대한 피처스토어를 나열하려면 featurestores.list 메서드를 사용하여 GET 요청을 전송합니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • LOCATION_ID: 피처스토어가 있는 리전(예: us-central1)
  • PROJECT_ID: 프로젝트 ID

HTTP 메서드 및 URL:

GET http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

다음 명령어를 실행합니다.

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores"

PowerShell

다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores" | Select-Object -Expand Content

다음과 비슷한 JSON 응답이 표시됩니다.

{
  "featurestores": [
    {
      "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/test",
      "createTime": "2021-02-26T00:44:44.216805Z",
      "updateTime": "2021-02-26T00:44:44.364916Z",
      "etag": "AMEw9yNL0s7qZh8lZVZ5T3BEuhoEgFR7JmjbbCSAkRZjeKDXkkIYnxxA4POe5BWT8cCn",
      "labels": {
        "environment": "testing"
      },
      "onlineServingConfig": {
        "fixedNodeCount": 2
      },
      "state": "STABLE"
    },
    {
      "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/featurestore_demo",
      "createTime": "2021-02-25T00:39:40.598781Z",
      "updateTime": "2021-02-25T00:39:40.744038Z",
      "etag": "AMEw9yO_e0vm-9W_yeCz4rJm-XnnEMYQ-vQesevxya_sz-FckuysnDwo3cEXHdWWSeda",
      "labels": {
        "environment": "testing"
      },
      "onlineServingConfig": {
        "fixedNodeCount": 3
      },
      "state": "STABLE"
    }
  ]
}

Java

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Java 설정 안내를 따르세요. 자세한 내용은 Vertex AI Java API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


import com.google.cloud.aiplatform.v1.Featurestore;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings;
import com.google.cloud.aiplatform.v1.ListFeaturestoresRequest;
import com.google.cloud.aiplatform.v1.LocationName;
import java.io.IOException;

public class ListFeaturestoresSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String project = "YOUR_PROJECT_ID";
    String location = "us-central1";
    String endpoint = "us-central1-aiplatform.googleapis.com:443";
    listFeaturestoresSample(project, location, endpoint);
  }

  static void listFeaturestoresSample(String project, String location, String endpoint)
      throws IOException {
    FeaturestoreServiceSettings featurestoreServiceSettings =
        FeaturestoreServiceSettings.newBuilder().setEndpoint(endpoint).build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (FeaturestoreServiceClient featurestoreServiceClient =
        FeaturestoreServiceClient.create(featurestoreServiceSettings)) {

      ListFeaturestoresRequest listFeaturestoresRequest =
          ListFeaturestoresRequest.newBuilder()
              .setParent(LocationName.of(project, location).toString())
              .build();

      System.out.println("List Featurestores Response");
      for (Featurestore element :
          featurestoreServiceClient.listFeaturestores(listFeaturestoresRequest).iterateAll()) {
        System.out.println(element);
      }
    }
  }
}

Node.js

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Node.js 설정 안내를 따르세요. 자세한 내용은 Vertex AI Node.js API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

/**
 * TODO(developer): Uncomment these variables before running the sample.\
 * (Not necessary if passing values as arguments)
 */

// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
// const apiEndpoint = 'YOUR_API_ENDPOINT';
// const timeout = <TIMEOUT_IN_MILLI_SECONDS>;

// Imports the Google Cloud Featurestore Service Client library
const {FeaturestoreServiceClient} = require('@google-cloud/aiplatform').v1;

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: apiEndpoint,
};

// Instantiates a client
const featurestoreServiceClient = new FeaturestoreServiceClient(
  clientOptions
);

async function listFeaturestores() {
  // Configure the parent resource
  const parent = `projects/${project}/locations/${location}`;

  const request = {
    parent: parent,
  };

  // List featurestores request
  const [response] = await featurestoreServiceClient.listFeaturestores(
    request,
    {timeout: Number(timeout)}
  );

  console.log('List featurestores response');
  console.log('Raw response:');
  console.log(JSON.stringify(response, null, 2));
}
listFeaturestores();

추가 언어

Python용 Vertex AI SDK를 설치하고 사용하는 방법은 Python용 Vertex AI SDK 사용을 참조하세요. 자세한 내용은 Python용 Vertex AI SDK API 참조 문서를 확인하세요.

피처스토어 세부정보 보기

이름 및 온라인 서빙 구성과 같은 피처스토어에 대한 세부정보를 가져옵니다. Google Cloud 콘솔을 사용하는 경우 피처스토어의 Cloud Monitoring 측정항목도 볼 수 있습니다.

웹 UI

  1. Google Cloud 콘솔의 Vertex AI 섹션에서 특성 페이지로 이동합니다.

    특성 페이지로 이동

  2. 리전 드롭다운 목록에서 리전을 선택합니다.
  3. 특성 테이블에서 특정 스토리지 열을 확인하여 정보를 보려는 피처스토어를 찾습니다.
  4. 피처스토어의 이름을 클릭하여 Monitoring 측정항목을 열람합니다.
  5. 속성 탭을 클릭하여 피처스토어의 온라인 제공 구성을 확인합니다.

REST

단일 피처스토어에 대한 세부정보를 가져오려면 featurestores.get 메서드를 사용하여 GET 요청을 전송합니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • LOCATION_ID: 피처스토어가 있는 리전(예: us-central1)
  • PROJECT_ID: 프로젝트 ID
  • FEATURESTORE_ID: 피처스토어의 ID

HTTP 메서드 및 URL:

GET http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

다음 명령어를 실행합니다.

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID"

PowerShell

다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID" | Select-Object -Expand Content

다음과 비슷한 JSON 응답이 표시됩니다.

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID",
  "createTime": "2021-02-25T00:39:40.598781Z",
  "updateTime": "2021-02-25T00:39:40.744038Z",
  "etag": "AMEw9yNy_b4IaMIvw1803ZT38cpUtjfwlyLkR709oBCY6pQrm6dHophLcqhrvsNqkQQZ",
  "onlineServingConfig": {
    "fixedNodeCount": 3
  },
  "state": "STABLE"
}

Java

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Java 설정 안내를 따르세요. 자세한 내용은 Vertex AI Java API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


import com.google.cloud.aiplatform.v1.Featurestore;
import com.google.cloud.aiplatform.v1.FeaturestoreName;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings;
import com.google.cloud.aiplatform.v1.GetFeaturestoreRequest;
import java.io.IOException;

public class GetFeaturestoreSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String project = "YOUR_PROJECT_ID";
    String featurestoreId = "YOUR_FEATURESTORE_ID";
    String location = "us-central1";
    String endpoint = "us-central1-aiplatform.googleapis.com:443";
    getFeaturestoreSample(project, featurestoreId, location, endpoint);
  }

  static void getFeaturestoreSample(
      String project, String featurestoreId, String location, String endpoint) throws IOException {

    FeaturestoreServiceSettings featurestoreServiceSettings =
        FeaturestoreServiceSettings.newBuilder().setEndpoint(endpoint).build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (FeaturestoreServiceClient featurestoreServiceClient =
        FeaturestoreServiceClient.create(featurestoreServiceSettings)) {

      GetFeaturestoreRequest getFeaturestoreRequest =
          GetFeaturestoreRequest.newBuilder()
              .setName(FeaturestoreName.of(project, location, featurestoreId).toString())
              .build();

      Featurestore featurestore = featurestoreServiceClient.getFeaturestore(getFeaturestoreRequest);
      System.out.println("Get Featurestore Response");
      System.out.println(featurestore);
    }
  }
}

Node.js

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Node.js 설정 안내를 따르세요. 자세한 내용은 Vertex AI Node.js API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

/**
 * TODO(developer): Uncomment these variables before running the sample.\
 * (Not necessary if passing values as arguments)
 */

// const project = 'YOUR_PROJECT_ID';
// const featurestoreId = 'YOUR_FEATURESTORE_ID';
// const location = 'YOUR_PROJECT_LOCATION';
// const apiEndpoint = 'YOUR_API_ENDPOINT';
// const timeout = <TIMEOUT_IN_MILLI_SECONDS>;

// Imports the Google Cloud Featurestore Service Client library
const {FeaturestoreServiceClient} = require('@google-cloud/aiplatform').v1;

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: apiEndpoint,
};

// Instantiates a client
const featurestoreServiceClient = new FeaturestoreServiceClient(
  clientOptions
);

async function getFeaturestore() {
  // Configure the parent resource
  const name = `projects/${project}/locations/${location}/featurestores/${featurestoreId}`;

  const request = {
    name: name,
  };

  // Get Featurestore request
  const [response] = await featurestoreServiceClient.getFeaturestore(
    request,
    {timeout: Number(timeout)}
  );

  console.log('Get featurestore response');
  console.log(`Name : ${response.name}`);
  console.log('Raw response:');
  console.log(JSON.stringify(response, null, 2));
}
getFeaturestore();

추가 언어

Python용 Vertex AI SDK를 설치하고 사용하는 방법은 Python용 Vertex AI SDK 사용을 참조하세요. 자세한 내용은 Python용 Vertex AI SDK API 참조 문서를 확인하세요.

피처스토어 업데이트

피처스토어를 업데이트하여, 예를 들어 피처스토어의 온라인 서빙 노드 수를 변경하거나 라벨을 업데이트합니다.

웹 UI

온라인 제공 노드 수만 업데이트할 수 있습니다. 라벨을 업데이트하려면 API를 사용합니다.

  1. Google Cloud 콘솔의 Vertex AI 섹션에서 특성 페이지로 이동합니다.

    특성 페이지로 이동

  2. 리전 드롭다운 목록에서 리전을 선택합니다.
  3. 특성 테이블에서 Featurestore 열을 확인하여 업데이트할 피처스토어의 이름을 클릭합니다.
  4. 구성 수정을 클릭하여 피처스토어 구성 수정 창을 엽니다.
  5. 피처스토어 구성을 수정합니다.
  6. 변경사항을 적용하려면 업데이트를 클릭합니다.

REST

피처스토어를 업데이트하려면 featurestores.patch 메서드를 사용하여 PATCH 요청을 전송합니다.

다음 샘플은 피처스토어의 온라인 서빙 노드 수를 2로 업데이트합니다. 다른 설정은 모두 그대로 유지됩니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • LOCATION_ID: 피처스토어가 있는 리전(예: us-central1)
  • PROJECT_ID: 프로젝트 ID
  • FEATURESTORE_ID: 피처스토어의 ID

HTTP 메서드 및 URL:

PATCH http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID

JSON 요청 본문:

{
  "online_serving_config": {
    "fixed_node_count": 2
  }
}

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID"

PowerShell

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID" | Select-Object -Expand Content

다음과 비슷한 출력이 표시됩니다. 응답의 OPERATION_ID를 사용하여 작업 상태를 가져올 수 있습니다.

{
"name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.UpdateFeaturestoreOperationMetadata",
    "genericMetadata": {
      "createTime": "2021-03-18T21:12:08.373664Z",
      "updateTime": "2021-03-18T21:12:08.373664Z"
    }
  }
}

Java

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Java 설정 안내를 따르세요. 자세한 내용은 Vertex AI Java API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.aiplatform.v1.Featurestore;
import com.google.cloud.aiplatform.v1.Featurestore.OnlineServingConfig;
import com.google.cloud.aiplatform.v1.Featurestore.OnlineServingConfig.Scaling;
import com.google.cloud.aiplatform.v1.FeaturestoreName;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings;
import com.google.cloud.aiplatform.v1.UpdateFeaturestoreOperationMetadata;
import com.google.cloud.aiplatform.v1.UpdateFeaturestoreRequest;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class UpdateFeaturestoreSample {

  public static void main(String[] args)
      throws IOException, InterruptedException, ExecutionException, TimeoutException {
    // TODO(developer): Replace these variables before running the sample.
    String project = "YOUR_PROJECT_ID";
    String featurestoreId = "YOUR_FEATURESTORE_ID";
    int minNodeCount = 2;
    int maxNodeCount = 4;
    String location = "us-central1";
    String endpoint = "us-central1-aiplatform.googleapis.com:443";
    int timeout = 300;
    updateFeaturestoreSample(
        project, featurestoreId, minNodeCount, maxNodeCount, location, endpoint, timeout);
  }

  static void updateFeaturestoreSample(
      String project,
      String featurestoreId,
      int minNodeCount,
      int maxNodeCount,
      String location,
      String endpoint,
      int timeout)
      throws IOException, InterruptedException, ExecutionException, TimeoutException {
    FeaturestoreServiceSettings featurestoreServiceSettings =
        FeaturestoreServiceSettings.newBuilder().setEndpoint(endpoint).build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (FeaturestoreServiceClient featurestoreServiceClient =
        FeaturestoreServiceClient.create(featurestoreServiceSettings)) {

      OnlineServingConfig.Builder builderValue =
          OnlineServingConfig.newBuilder()
              .setScaling(
                  Scaling.newBuilder().setMinNodeCount(minNodeCount).setMaxNodeCount(maxNodeCount));
      Featurestore featurestore =
          Featurestore.newBuilder()
              .setName(FeaturestoreName.of(project, location, featurestoreId).toString())
              .setOnlineServingConfig(builderValue)
              .build();

      UpdateFeaturestoreRequest request =
          UpdateFeaturestoreRequest.newBuilder().setFeaturestore(featurestore).build();

      OperationFuture<Featurestore, UpdateFeaturestoreOperationMetadata> updateFeaturestoreFuture =
          featurestoreServiceClient.updateFeaturestoreAsync(request);
      System.out.format(
          "Operation name: %s%n", updateFeaturestoreFuture.getInitialFuture().get().getName());
      System.out.println("Waiting for operation to finish...");
      Featurestore featurestoreResponse = updateFeaturestoreFuture.get(timeout, TimeUnit.SECONDS);
      System.out.println("Update Featurestore Response");
      System.out.format("Name: %s%n", featurestoreResponse.getName());
    }
  }
}

Node.js

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Node.js 설정 안내를 따르세요. 자세한 내용은 Vertex AI Node.js API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

/**
 * TODO(developer): Uncomment these variables before running the sample.\
 * (Not necessary if passing values as arguments)
 */

// const project = 'YOUR_PROJECT_ID';
// const featurestoreId = 'YOUR_FEATURESTORE_ID';
// const minNodeCount = <MINIMUM_NO_OF_NODES>;
// const maxNodeCount = <MAXIMUM_NO_OF_NODES>;
// const location = 'YOUR_PROJECT_LOCATION';
// const apiEndpoint = 'YOUR_API_ENDPOINT';
// const timeout = <TIMEOUT_IN_MILLI_SECONDS>;

// Imports the Google Cloud Featurestore Service Client library
const {FeaturestoreServiceClient} =
  require('@google-cloud/aiplatform').v1beta1;

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: apiEndpoint,
};

// Instantiates a client
const featurestoreServiceClient = new FeaturestoreServiceClient(
  clientOptions
);

async function updateFeaturestore() {
  // Configure the parent resource
  const parent = `projects/${project}/locations/${location}/featurestores/${featurestoreId}`;

  const featurestore = {
    name: parent,
    onlineServingConfig: {
      scaling: {
        minNodeCount: minNodeCount,
        maxNodeCount: maxNodeCount,
      },
    },
  };

  const request = {
    featurestore: featurestore,
  };

  // Update Featurestore request
  const [operation] = await featurestoreServiceClient.updateFeaturestore(
    request,
    {timeout: Number(timeout)}
  );
  const [response] = await operation.promise();

  console.log('Update featurestore response');
  console.log(`Name : ${response.name}`);
  console.log('Raw response:');
  console.log(JSON.stringify(response, null, 2));
}
updateFeaturestore();

추가 언어

Python용 Vertex AI SDK를 설치하고 사용하는 방법은 Python용 Vertex AI SDK 사용을 참조하세요. 자세한 내용은 Python용 Vertex AI SDK API 참조 문서를 확인하세요.

피처스토어 삭제

피처스토어를 삭제합니다. 피처스토어에 기존 항목 유형 및 특성이 포함된 경우 피처스토어 및 모든 해당 콘텐츠를 삭제하도록 force 쿼리 매개변수를 사용 설정합니다.

웹 UI

다른 메서드를 사용합니다. Google Cloud 콘솔에서 피처스토어를 삭제할 수 없습니다.

REST

피처스토어 및 모든 콘텐츠를 삭제하려면 featurestores.delete 메서드를 사용하여 DELETE 요청을 전송합니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • LOCATION_ID: 피처스토어가 있는 리전(예: us-central1)
  • PROJECT_ID: 프로젝트 ID
  • FEATURESTORE_ID: 피처스토어의 ID
  • BOOLEAN: 항목 유형 및 특성을 포함하는 경우에도 피처스토어를 삭제할지 여부. force 쿼리 매개변수는 선택사항이고 기본적으로 false입니다.

HTTP 메서드 및 URL:

DELETE http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID?force=BOOLEAN

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

다음 명령어를 실행합니다.

curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID?force=BOOLEAN"

PowerShell

다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID?force=BOOLEAN" | Select-Object -Expand Content

다음과 비슷한 JSON 응답이 표시됩니다.

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/operations/OPERATIONS_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.DeleteOperationMetadata",
    "genericMetadata": {
      "createTime": "2021-05-03T17:50:21.813112Z",
      "updateTime": "2021-05-03T17:50:21.813112Z"
    }
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.protobuf.Empty"
  }
}

Python

Python용 Vertex AI SDK를 설치하거나 업데이트하는 방법은 Python용 Vertex AI SDK 설치를 참조하세요. 자세한 내용은 Python API 참고 문서를 확인하세요.

from google.cloud import aiplatform

def delete_featurestore_sample(
    project: str,
    location: str,
    featurestore_name: str,
    sync: bool = True,
    force: bool = True,
):

    aiplatform.init(project=project, location=location)

    fs = aiplatform.featurestore.Featurestore(featurestore_name=featurestore_name)
    fs.delete(sync=sync, force=force)

Python

Vertex AI 클라이언트 라이브러리는 Python용 Vertex AI SDK를 설치할 때 포함됩니다. Python용 Vertex AI SDK를 설치하는 방법은 Python용 Vertex AI SDK 설치를 참조하세요. 자세한 내용은 Python용 Vertex AI SDK API 참고 문서를 확인하세요.

from google.cloud import aiplatform

def delete_featurestore_sample(
    project: str,
    featurestore_id: str,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com",
    timeout: int = 1200,
):
    # The AI Platform services require regional API endpoints, which need to be
    # in the same region or multi-region overlap with the Feature Store location.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.FeaturestoreServiceClient(client_options=client_options)
    name = client.featurestore_path(
        project=project, location=location, featurestore=featurestore_id
    )
    response = client.delete_featurestore(name=name)
    print("Long running operation:", response.operation.name)
    delete_featurestore_response = response.result(timeout=timeout)
    print("delete_featurestore_response:", delete_featurestore_response)

Java

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Java 설정 안내를 따르세요. 자세한 내용은 Vertex AI Java API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.aiplatform.v1.DeleteFeaturestoreRequest;
import com.google.cloud.aiplatform.v1.DeleteOperationMetadata;
import com.google.cloud.aiplatform.v1.FeaturestoreName;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class DeleteFeaturestoreSample {

  public static void main(String[] args)
      throws IOException, InterruptedException, ExecutionException, TimeoutException {
    // TODO(developer): Replace these variables before running the sample.
    String project = "YOUR_PROJECT_ID";
    String featurestoreId = "YOUR_FEATURESTORE_ID";
    boolean useForce = true;
    String location = "us-central1";
    String endpoint = "us-central1-aiplatform.googleapis.com:443";
    int timeout = 60;
    deleteFeaturestoreSample(project, featurestoreId, useForce, location, endpoint, timeout);
  }

  static void deleteFeaturestoreSample(
      String project,
      String featurestoreId,
      boolean useForce,
      String location,
      String endpoint,
      int timeout)
      throws IOException, InterruptedException, ExecutionException, TimeoutException {

    FeaturestoreServiceSettings featurestoreServiceSettings =
        FeaturestoreServiceSettings.newBuilder().setEndpoint(endpoint).build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (FeaturestoreServiceClient featurestoreServiceClient =
        FeaturestoreServiceClient.create(featurestoreServiceSettings)) {

      DeleteFeaturestoreRequest deleteFeaturestoreRequest =
          DeleteFeaturestoreRequest.newBuilder()
              .setName(FeaturestoreName.of(project, location, featurestoreId).toString())
              .setForce(useForce)
              .build();

      OperationFuture<Empty, DeleteOperationMetadata> operationFuture =
          featurestoreServiceClient.deleteFeaturestoreAsync(deleteFeaturestoreRequest);
      System.out.format("Operation name: %s%n", operationFuture.getInitialFuture().get().getName());
      System.out.println("Waiting for operation to finish...");
      operationFuture.get(timeout, TimeUnit.SECONDS);

      System.out.format("Deleted Featurestore.");
    }
  }
}

Node.js

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Node.js 설정 안내를 따르세요. 자세한 내용은 Vertex AI Node.js API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

/**
 * TODO(developer): Uncomment these variables before running the sample.\
 * (Not necessary if passing values as arguments)
 */

// const project = 'YOUR_PROJECT_ID';
// const featurestoreId = 'YOUR_FEATURESTORE_ID';
// const force = <BOOLEAN>;
// const location = 'YOUR_PROJECT_LOCATION';
// const apiEndpoint = 'YOUR_API_ENDPOINT';
// const timeout = <TIMEOUT_IN_MILLI_SECONDS>;

// Imports the Google Cloud Featurestore Service Client library
const {FeaturestoreServiceClient} = require('@google-cloud/aiplatform').v1;

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: apiEndpoint,
};

// Instantiates a client
const featurestoreServiceClient = new FeaturestoreServiceClient(
  clientOptions
);

async function deleteFeaturestore() {
  // Configure the name resource
  const name = `projects/${project}/locations/${location}/featurestores/${featurestoreId}`;

  const request = {
    name: name,
    force: Boolean(force),
  };

  // Delete Featurestore request
  const [operation] = await featurestoreServiceClient.deleteFeaturestore(
    request,
    {timeout: Number(timeout)}
  );
  const [response] = await operation.promise();

  console.log('Delete featurestore response');
  console.log('Raw response:');
  console.log(JSON.stringify(response, null, 2));
}
deleteFeaturestore();

다음 단계