“创建新版本”忽略自定义服务帐户

时间:2019-11-19 10:33:54

标签: google-cloud-platform google-cloud-ml

我正在尝试将新版本的模型部署到AI平台,这是一个自定义的预测例程。当我在同一个GCP项目中拥有所有资源时,我已经设法很好地进行了部署,但是当我尝试进行部署并且将GCS文件指向其他项目中的存储桶时,部署失败。因此,我试图在创建版本时传递要使用的服务帐户,但是它一直忽略它。

这就是我收到的消息:

googleapiclient.errors.HttpError: <HttpError 400 when requesting https://ml.googleapis.com/v1/projects/[gcp-project-1]/models/[model_name]/versions?alt=json returned "Field: version.deployment_uri Error: The provided GCS prefix [gs://[bucket-gcp-project-2]/] cannot be read by service account service-*****@cloud-ml.google.com.iam.gserviceaccount.com.". Details: "[{'@type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'version.deployment_uri', 'description': 'The provided GCS prefix [gs://[bucket-gcp-project-2]/] cannot be read by service account service-******@cloud-ml.google.com.iam.gserviceaccount.com.'}]}]

我的请求看起来像

POST https://ml.googleapis.com/v1/projects/[gcp-project-1]/models/[model_name]/versions?alt=json

    {
        "name": "v1",
        "deploymentUri": "gs://[bucket-gcp-project-2]",
        "pythonVersion": "3.5",
        "runtimeVersion": "1.13",
        "package_uris": "gs://[bucket-gcp-project-2]/model.tar.gz",
        "predictionClass": "predictor.Predictor",
        "serviceAccount": "my-service-account@[gcp-project-1].iam.gserviceaccount.com"
    }

服务帐户在两个项目中都可以访问

1 个答案:

答案 0 :(得分:0)

指定服务帐户记录为beta feature。尝试使用gcloud SDK,例如:

gcloud components install beta

gcloud beta ai-platform versions create v1 \
  --service-account my-service-account@[gcp-project-1].iam.gserviceaccount.com ...