云端存储桶上的ml ml引擎读取访问

时间:2018-08-28 13:02:20

标签: node.js google-app-engine google-cloud-platform google-cloud-ml google-api-nodejs-client

我正在尝试通过我的nodejs应用引擎项目启动Cloud ML-Engine作业。 由于没有适用的库,因此我使用的是“ googleapis”:

const {google} = require('googleapis');
const params = {
    parent: 'projects/my-playground',
    requestBody: {
        jobId: 'test-job-' + Date.now(),
        trainingInput: {
            runtimeVersion: '1.6',
            jobDir: 'gs://my-ml-test-bucket',
            packageUris: ['gs://my-ml-test-bucket/MLEngine/trainer'],
            pythonModule: 'trainer.task',

            scaleTier: "CUSTOM",
            masterType: "complex_model_l",
            workerCount: "0",
            workerType: "standard",
            parameterServerCount: "0",
            parameterServerType: "standard",
            region: "europe-west1",

            args: [
                'file=gs://my-ml-test-bucket/testFile.csv',
                'threshold=0.5',
                'latent-factors=15',
                'iterations=50'
            ]
        }
    }
};
google.auth.getClient()
    .then(authClient => {
        const ML = google.ml({
            version: 'v1',
            auth: authClient
        });
        ML.projects.jobs.create(params)
    });

执行代码时,出现以下错误:

Error creating the job. Field: package_uris Error: The provided GCS paths [gs://my-ml-test-bucket/MLEngine/trainer] cannot be read. Please make sure that the objects exist and you have read access to it.

所有文件都已上载到此目录,并且Cloud ML Service Agent拥有存储桶中的Storage Object Admin权限,但仍然出现此错误。 有什么想法吗?

1 个答案:

答案 0 :(得分:2)

似乎您已经在packageUris的{​​{1}}参数中指定了目录名称。如果您已将培训师代码上传到Cloud Storage,则应将完整路径传递给压缩的存档文件。

例如,如果您的培训计划名为trainingInput,则可以传递以下值:trainer.tar.gz

以下链接提供了有关在Cloud ML Engine上创建和使用程序包的更多信息:https://cloud.google.com/ml-engine/docs/tensorflow/packaging-trainer