Skip to content

Commit

Permalink
chore(components): Add check that component in preview.custom_job.uti…
Browse files Browse the repository at this point in the history
…ls.create_custom_training_job_from_component doesn't have any parameters that share names with any custom job fields

Signed-off-by: Googler <[email protected]>
PiperOrigin-RevId: 655646695
  • Loading branch information
Googler committed Jul 24, 2024
1 parent 58b342a commit 62b355a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/google-cloud/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* In the Starry-Net pipeline, enforce that TF Record generation always runs before test set generation to speed up pipelines runs.
* Add support for running tasks on a `PersistentResource` (see [CustomJobSpec](https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/CustomJobSpec)) via `persistent_resource_id` parameter on `v1.custom_job.CustomTrainingJobOp` and `v1.custom_job.create_custom_training_job_from_component`
* Bump image for Structured Data pipelines.
* Add check that component in preview.custom_job.utils.create_custom_training_job_from_component doesn't have any parameters that share names with any custom job fields

## Release 2.15.0
* Add Gemini batch prediction support to `v1.model_evaluation.autosxs_pipeline`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,23 @@ def create_custom_training_job_from_component(
'defaultValue'
] = default_value

# check if user component has any input parameters that already exist in the
# custom job component
for param_name in user_component_spec.get('inputDefinitions', {}).get(
'parameters', {}
):
if param_name in cj_component_spec['inputDefinitions']['parameters']:
raise ValueError(
f'Input parameter {param_name} already exists in the CustomJob component.' # pylint: disable=line-too-long
)
for param_name in user_component_spec.get('outputDefinitions', {}).get(
'parameters', {}
):
if param_name in cj_component_spec['outputDefinitions']['parameters']:
raise ValueError(
f'Output parameter {param_name} already exists in the CustomJob component.' # pylint: disable=line-too-long
)

# merge parameters from user component into the customjob component
cj_component_spec['inputDefinitions']['parameters'].update(
user_component_spec.get('inputDefinitions', {}).get('parameters', {})
Expand Down

0 comments on commit 62b355a

Please sign in to comment.