列出同步操作

您可以查看针对特定特征视图执行的数据同步操作列表。如果您要验证数据同步是否已从 BigQuery 数据源成功同步,或者特征视图是否正在进行数据同步,这将非常有用。

准备工作

向 Vertex AI 进行身份验证,除非您已完成此操作。

To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.

    Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:

    gcloud init

    If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

For more information, see Authenticate for using REST in the Google Cloud authentication documentation.

在特征视图中列出同步操作

使用以下示例可查看针对某个特征视图执行的所有同步操作的列表。

REST

如需查看 FeatureView 实例中的数据同步操作列表,请使用 featureViewSyncs.list 方法发送 GET 请求。

在使用任何请求数据之前,请先进行以下替换:

  • LOCATION_ID:在线存储区所在的区域,例如 us-central1
  • PROJECT_ID:您的项目 ID。
  • FEATUREONLINESTORE_NAME:包含特征视图的在线存储区的名称。
  • FEATUREVIEW_NAME:要查看其数据同步操作列表的特征视图的名称。

HTTP 方法和网址:

GET https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME/featureViewSyncs

如需发送请求,请选择以下方式之一:

curl

执行以下命令:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME/featureViewSyncs"

PowerShell

执行以下命令:

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

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME/featureViewSyncs" | Select-Object -Expand Content

您应该收到类似以下内容的 JSON 响应:

{
  "featureViewSyncs": [
    {
      "name": "PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME/featureViewSyncs/OPERATION_ID_1",
      "createTime": "2023-09-11T15:33:24.906716Z",
      "dataTransfer": {
        "endTime": "2023-09-11T15:33:43.615598Z"
      },
      "finalStatus": {
        "code": 13
      },
      "runTime": {
        "endTime": "2023-09-11T15:33:43.615598Z"
      }
    },
    {
      "name": "PROJECT_ID/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/featureViews/FEATUREVIEW_NAME/featureViewSyncs/OPERATION_ID_2",
      "createTime": "2023-09-06T23:48:00.670844Z",
      "dataTransfer": {
        "endTime": "2023-09-06T23:48:19.086848Z"
      },
      "finalStatus": {
        "code": 13
      },
      "runTime": {
        "endTime": "2023-09-06T23:48:19.086848Z"
      }
    }
  ]
}

后续步骤