Mahmoud daasan
Mahmoud daasan

Reputation: 1

Issue when trying to use gcloud ai custom-jobs create

I'm trying to to ML project using Google Cloud and I'm using Docker. I pushed the Docker and all but when it comes to the gcloud custom-job it fails. This is my yaml file:

displayName: simple-job
jobSpec:
  workerPoolSpecs:
  - machineSpec:
      machineType: n1-standard-4
    replicaCount: 1
    pythonPackageSpec:
      executorImageUri: gcr.io/weighty-wonder-433506-e6/cat-breed-flask
      packageUris:
        - gs://cat-dataset/trainer.tar.gz
      pythonModule: train_model

and i get this

> gcloud ai custom-jobs create --region=us-central1 --display-name=simple-job --config=job.yaml

Using endpoint [https://us-central1-aiplatform.googleapis.com/]
ERROR: (gcloud.ai.custom-jobs.create) INVALID_ARGUMENT: Invalid JSON payload received. Unknown name "displayName" at 'custom_job.job_spec': Cannot find field.
Invalid JSON payload received. Unknown name "jobSpec" at 'custom_job.job_spec': Cannot find field.
- '@type': type.googleapis.com/google.rpc.BadRequest
  fieldViolations:
  - description: "Invalid JSON payload received. Unknown name \"displayName\" at 'custom_job.job_spec':\
      \ Cannot find field."
    field: custom_job.job_spec
  - description: "Invalid JSON payload received. Unknown name \"jobSpec\" at 'custom_job.job_spec':\
      \ Cannot find field."
    field: custom_job.job_spec

Upvotes: 0

Views: 184

Answers (1)

DazWilkin
DazWilkin

Reputation: 40296

Have a look at the documentation for gcloud ai custom-jobs create command's --config flag.

It provides an (incorrect!) example CustomJobSpec type for you.

Your YAML is correct except it should be rooted at workerPoolSpecs.

Try:

workerPoolSpecs:
- machineSpec:
    machineType: n1-standard-4
  replicaCount: 1
  pythonPackageSpec:
    executorImageUri: gcr.io/weighty-wonder-433506-e6/cat-breed-flask
    packageUris:
    - gs://cat-dataset/trainer.tar.gz
    pythonModule: train_model

Upvotes: 0

Related Questions