I created a custom job on Google Cloud Platform Vertex AI based on a Python distribution with some configuration inputs. For example:
The list of these inputs are available in the Training menu in a JSON format:
{
"workerPoolSpecs": [
{
"machineSpec": {
"machineType": "n1-standard-4"
},
"replicaCount": "1",
"diskSpec": {
"bootDiskType": "pd-standard",
"bootDiskSizeGb": 100
},
"pythonPackageSpec": {
"executorImageUri": "europe-docker.pkg.dev/vertex-ai/training/sklearn-cpu.1-0:latest",
"packageUris": [
"gs://my_bucket_for_vertexai/my_package_directory/trainer-0.1.tar.gz"
],
"pythonModule": "trainer.task"
}
}
],
"baseOutputDirectory": {
"outputUriPrefix": "gs://my_bucket_for_vertexai/my_output_directory/"
}
}
How can my job automatically retrieve these parameters without their value being written in the Python code ?
You can retrieve the JSON you show with
aiplatform.CustomJob.get(job_id)
. This answer shows how you can get the job ID. The only thing is, I am not sure if these resources are created before the container is run so that it can access them..