I’m trying to implement code to start a custom job in Vertex.
I have no problem starting a custom job using gcloud
:
gcloud ai custom-jobs --project my_project_id create --region=europe-west1 --display-name="train model based on custom container" --worker-pool-spec=machine-type=n1-standard-4,replica-count=1,container-image-uri=europe-west1-docker.pkg.dev/my_project_id/my-repo/my-custom-prototype:latest
I’ve not been able to find official code sample for .NET but tried to mimick someone else doing it in Python plus ChatGPT produced a similar code sample:
var projectId = "my_project_id";
var locationId = "europe-west1";
var client = await JobServiceClient.CreateAsync();
var createCustomJobRequest = new CreateCustomJobRequest
{
ParentAsLocationName = new LocationName(projectId, locationId),
CustomJob = new CustomJob
{
DisplayName = "train model based on custom container",
JobSpec = new CustomJobSpec()
{
WorkerPoolSpecs =
{
new WorkerPoolSpec
{
MachineSpec = new MachineSpec
{
MachineType = "n1-standard-4"
},
ReplicaCount = 1,
ContainerSpec = new ContainerSpec()
{
ImageUri = "europe-west1-docker.pkg.dev/my_project_id/my-repo/my-custom-prototype:latest"
}
}
}
}
}
};
var result3 = await client.CreateCustomJobAsync(createCustomJobRequest); // exception thrown here
Unfortunately, I get an exception back:
Grpc.Core.RpcException: 'Status(StatusCode="Unimplemented", Detail="Bad gRPC response. HTTP status code: 404")'
Things I’ve tried and failed
- Used the overload of
CreateCustomJobAsync()
that takes aCustomJob
and aParent
instead of aCreateCustomJobRequest
object. - Used
JobServiceClientBuilder
instead ofJobServiceClient.CreateAsync()
and set theEndpoint
argument aseurope-west1-aiplatform.googleapis.com
.
What am I missing to get a custom job started in Vertex AI?
Read more here: Source link