Skip to content

Commit

Permalink
refactored unit test case for better assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
ryota-cloud committed Mar 5, 2025
1 parent f900f6d commit 5c46c59
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 59 deletions.
4 changes: 2 additions & 2 deletions metadata-ingestion/src/datahub/ingestion/source/vertexai.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def _gen_ml_group_mcps(
def _make_ml_model_group_urn(self, model: Model) -> str:
urn = builder.make_ml_model_group_urn(
platform=self.platform,
group_name=self._make_vertexai_model_name(model.name),
group_name=self._make_vertexai_model_group_name(model.name),
env=self.config.env,
)
return urn
Expand Down Expand Up @@ -520,7 +520,7 @@ def _gen_endpoint_mcps(
endpoint_urn = builder.make_ml_model_deployment_urn(
platform=self.platform,
deployment_name=self._make_vertexai_endpoint_name(
entity_id=endpoint.display_name
entity_id=endpoint.name
),
env=self.config.env,
)
Expand Down
127 changes: 102 additions & 25 deletions metadata-ingestion/tests/integration/vertexai/vertexai_mcps_golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107353572,
"lastObserved": 1741198547912,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -30,7 +30,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107353573,
"lastObserved": 1741198547912,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -46,7 +46,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107353573,
"lastObserved": 1741198547913,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -64,7 +64,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107353573,
"lastObserved": 1741198547913,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -80,14 +80,14 @@
}
},
"systemMetadata": {
"lastObserved": 1741107353574,
"lastObserved": 1741198547913,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
},
{
"entityType": "mlModelGroup",
"entityUrn": "urn:li:mlModelGroup:(urn:li:dataPlatform:vertexai,test-project-id.model.mock_prediction_model_1,PROD)",
"entityUrn": "urn:li:mlModelGroup:(urn:li:dataPlatform:vertexai,test-project-id.model_group.mock_prediction_model_1,PROD)",
"changeType": "UPSERT",
"aspectName": "mlModelGroupProperties",
"aspect": {
Expand All @@ -100,14 +100,14 @@
}
},
"systemMetadata": {
"lastObserved": 1741107353574,
"lastObserved": 1741198547914,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
},
{
"entityType": "mlModelGroup",
"entityUrn": "urn:li:mlModelGroup:(urn:li:dataPlatform:vertexai,test-project-id.model.mock_prediction_model_2,PROD)",
"entityUrn": "urn:li:mlModelGroup:(urn:li:dataPlatform:vertexai,test-project-id.model_group.mock_prediction_model_2,PROD)",
"changeType": "UPSERT",
"aspectName": "mlModelGroupProperties",
"aspect": {
Expand All @@ -120,7 +120,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107354209,
"lastObserved": 1741198547916,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -139,13 +139,13 @@
"externalUrl": "https://console.cloud.google.com/vertex-ai/training/training-pipelines?trainingPipelineId=mock_training_job?project=test-project-id",
"name": "test-project-id.job.mock_training_job",
"created": {
"time": 1741107354209,
"time": 1741198547915,
"actor": "urn:li:platformResource:vertexai"
}
}
},
"systemMetadata": {
"lastObserved": 1741107356953,
"lastObserved": 1741198547917,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -163,7 +163,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107356956,
"lastObserved": 1741198547917,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -181,7 +181,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107356958,
"lastObserved": 1741198547917,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -197,7 +197,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107356958,
"lastObserved": 1741198547918,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -216,13 +216,13 @@
"externalUrl": "https://console.cloud.google.com/vertex-ai/training/training-pipelines?trainingPipelineId=mock_auto_automl_tabular_job?project=test-project-id",
"name": "test-project-id.job.mock_auto_automl_tabular_job",
"created": {
"time": 1741107356952,
"time": 1741198547917,
"actor": "urn:li:platformResource:vertexai"
}
}
},
"systemMetadata": {
"lastObserved": 1741107356959,
"lastObserved": 1741198547919,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -240,7 +240,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107356960,
"lastObserved": 1741198547919,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -258,7 +258,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107356960,
"lastObserved": 1741198547920,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -274,7 +274,84 @@
}
},
"systemMetadata": {
"lastObserved": 1741107356961,
"lastObserved": 1741198547920,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
},
{
"entityType": "dataProcessInstance",
"entityUrn": "urn:li:dataProcessInstance:test-project-id.job.mock_auto_automl_tabular_job",
"changeType": "UPSERT",
"aspectName": "dataProcessInstanceProperties",
"aspect": {
"json": {
"customProperties": {
"displayName": "mock_auto_automl_tabular_job_display_name",
"jobType": "AutoMLTabularTrainingJob"
},
"externalUrl": "https://console.cloud.google.com/vertex-ai/training/training-pipelines?trainingPipelineId=mock_auto_automl_tabular_job?project=test-project-id",
"name": "test-project-id.job.mock_auto_automl_tabular_job",
"created": {
"time": 1741198547919,
"actor": "urn:li:platformResource:vertexai"
}
}
},
"systemMetadata": {
"lastObserved": 1741198547920,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
},
{
"entityType": "dataProcessInstance",
"entityUrn": "urn:li:dataProcessInstance:test-project-id.job.mock_auto_automl_tabular_job",
"changeType": "UPSERT",
"aspectName": "mlTrainingRunProperties",
"aspect": {
"json": {
"customProperties": {},
"externalUrl": "https://console.cloud.google.com/vertex-ai/training/training-pipelines?trainingPipelineId=mock_auto_automl_tabular_job?project=test-project-id",
"id": "mock_auto_automl_tabular_job"
}
},
"systemMetadata": {
"lastObserved": 1741198547921,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
},
{
"entityType": "dataProcessInstance",
"entityUrn": "urn:li:dataProcessInstance:test-project-id.job.mock_auto_automl_tabular_job",
"changeType": "UPSERT",
"aspectName": "subTypes",
"aspect": {
"json": {
"typeNames": [
"Training Job"
]
}
},
"systemMetadata": {
"lastObserved": 1741198547921,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
},
{
"entityType": "dataProcessInstance",
"entityUrn": "urn:li:dataProcessInstance:test-project-id.job.mock_auto_automl_tabular_job",
"changeType": "UPSERT",
"aspectName": "container",
"aspect": {
"json": {
"container": "urn:li:container:29746a9030349f4340ed74b46913dab6"
}
},
"systemMetadata": {
"lastObserved": 1741198547922,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -290,7 +367,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107356961,
"lastObserved": 1741198547922,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand All @@ -306,14 +383,14 @@
}
},
"systemMetadata": {
"lastObserved": 1741107356962,
"lastObserved": 1741198547922,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
},
{
"entityType": "mlModelGroup",
"entityUrn": "urn:li:mlModelGroup:(urn:li:dataPlatform:vertexai,test-project-id.model.mock_prediction_model_1,PROD)",
"entityUrn": "urn:li:mlModelGroup:(urn:li:dataPlatform:vertexai,test-project-id.model_group.mock_prediction_model_1,PROD)",
"changeType": "UPSERT",
"aspectName": "status",
"aspect": {
Expand All @@ -322,14 +399,14 @@
}
},
"systemMetadata": {
"lastObserved": 1741107356962,
"lastObserved": 1741198547923,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
},
{
"entityType": "mlModelGroup",
"entityUrn": "urn:li:mlModelGroup:(urn:li:dataPlatform:vertexai,test-project-id.model.mock_prediction_model_2,PROD)",
"entityUrn": "urn:li:mlModelGroup:(urn:li:dataPlatform:vertexai,test-project-id.model_group.mock_prediction_model_2,PROD)",
"changeType": "UPSERT",
"aspectName": "status",
"aspect": {
Expand All @@ -338,7 +415,7 @@
}
},
"systemMetadata": {
"lastObserved": 1741107356963,
"lastObserved": 1741198547923,
"runId": "vertexai-source-test",
"lastRunId": "no-run-id-provided"
}
Expand Down
Loading

0 comments on commit 5c46c59

Please sign in to comment.