25
25
from datahub ._codegen .aspect import _Aspect
26
26
from datahub .configuration .source_common import EnvConfigMixin
27
27
from datahub .emitter .mcp import MetadataChangeProposalWrapper
28
- from datahub .emitter .mcp_builder import ContainerKey , ProjectIdKey , gen_containers
28
+ from datahub .emitter .mcp_builder import ProjectIdKey , gen_containers
29
29
from datahub .ingestion .api .common import PipelineContext
30
30
from datahub .ingestion .api .decorators import (
31
31
SupportStatus ,
47
47
from datahub .metadata .schema_classes import (
48
48
AuditStampClass ,
49
49
ContainerClass ,
50
+ DataPlatformInstanceClass ,
50
51
DataProcessInstanceInputClass ,
51
52
DataProcessInstancePropertiesClass ,
53
+ DataProcessInstanceRunEventClass ,
54
+ DataProcessInstanceRunResultClass ,
55
+ DataProcessRunStatusClass ,
52
56
DatasetPropertiesClass ,
53
57
MLModelDeploymentPropertiesClass ,
54
58
MLModelGroupPropertiesClass ,
55
59
MLModelPropertiesClass ,
60
+ MLTrainingRunPropertiesClass ,
61
+ RunResultTypeClass ,
56
62
SubTypesClass ,
57
63
TimeStampClass ,
58
64
VersionTagClass ,
59
- MLTrainingRunPropertiesClass ,
60
- RunResultTypeClass ,
61
- DataProcessInstanceRunEventClass ,
62
- DataProcessRunStatusClass ,
63
- DataProcessInstanceRunResultClass ,
64
- DataPlatformInstanceClass
65
65
)
66
66
from datahub .utilities .str_enum import StrEnum
67
67
from datahub .utilities .time import datetime_to_ts_millis
@@ -502,7 +502,7 @@ def _gen_ml_group_mcps(
502
502
customProperties = {"displayName" : model .display_name },
503
503
),
504
504
SubTypesClass (typeNames = [MLTypes .MODEL_GROUP ]),
505
- ContainerClass (container = self ._get_project_container ().as_urn ())
505
+ ContainerClass (container = self ._get_project_container ().as_urn ()),
506
506
],
507
507
)
508
508
@@ -518,12 +518,15 @@ def _get_project_container(self) -> ProjectIdKey:
518
518
return ProjectIdKey (project_id = self .config .project_id , platform = self .platform )
519
519
520
520
def _is_automl_job (self , job : VertexAiResourceNoun ) -> bool :
521
- return (
522
- isinstance (job , AutoMLTabularTrainingJob )
523
- or isinstance (job , AutoMLTextTrainingJob )
524
- or isinstance (job , AutoMLImageTrainingJob )
525
- or isinstance (job , AutoMLVideoTrainingJob )
526
- or isinstance (job , AutoMLForecastingTrainingJob )
521
+ return isinstance (
522
+ job ,
523
+ (
524
+ AutoMLTabularTrainingJob ,
525
+ AutoMLTextTrainingJob ,
526
+ AutoMLImageTrainingJob ,
527
+ AutoMLVideoTrainingJob ,
528
+ AutoMLForecastingTrainingJob ,
529
+ ),
527
530
)
528
531
529
532
def _search_model_version (
@@ -682,7 +685,9 @@ def _gen_endpoints_mcps(
682
685
customProperties = {"displayName" : endpoint .display_name },
683
686
),
684
687
# TODO add followings when metadata for MLModelDeployment is updated (these aspects not supported currently)
685
- ContainerClass (container = self ._get_project_container ().as_urn ()),
688
+ ContainerClass (
689
+ container = self ._get_project_container ().as_urn ()
690
+ ),
686
691
# SubTypesClass(typeNames=[MLTypes.ENDPOINT])
687
692
],
688
693
)
@@ -762,7 +767,7 @@ def _gen_ml_model_mcps(
762
767
ContainerClass (
763
768
container = self ._get_project_container ().as_urn (),
764
769
),
765
- SubTypesClass (typeNames = [MLTypes .MODEL ])
770
+ SubTypesClass (typeNames = [MLTypes .MODEL ]),
766
771
],
767
772
)
768
773
@@ -779,11 +784,7 @@ def _search_endpoint(self, model: Model) -> List[Endpoint]:
779
784
endpoint_dict [resource .model ].append (endpoint )
780
785
self .endpoints = endpoint_dict
781
786
782
- endpoints = (
783
- self .endpoints [model .resource_name ]
784
- if model .resource_name in self .endpoints
785
- else []
786
- )
787
+ endpoints = self .endpoints .get (model .resource_name , [])
787
788
return endpoints
788
789
789
790
def _make_ml_model_urn (self , model_version : VersionInfo , model_name : str ) -> str :
0 commit comments