Skip to content

Commit

Permalink
chore(components): Temporary fix for artifact types (cf. kubeflow#8191)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 483477877
  • Loading branch information
chongyouquan authored and jlyaoyuli committed Jan 5, 2023
1 parent 5e1948f commit 49de8d1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ def convert_method_to_component(cls: aiplatform.base.VertexAiResourceNoun,
output_name=output_metadata_name)
except TypeError:
from kfp.components import placeholders
output_spec = structures.OutputSpec(type=output_metadata_type)
output_spec = structures.OutputSpec(
type=(output_metadata_type + '@0.0.1'))
output_uri_placeholder = placeholders.OutputUriPlaceholder(
output_name=output_metadata_name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,21 @@
# The artifact property key for the resource name
ARTIFACT_PROPERTY_KEY_RESOURCE_NAME = 'resourceName'


def google_artifact(type_name):
"Decorator for Google Artifact types for handling KFP v1/v2 artifact types"
def add_type_name(cls):
if hasattr(dsl.Artifact, 'schema_title'):
cls.schema_title = type_name
cls.schema_version = '0.0.1'
else:
cls.TYPE_NAME = type_name
return cls
return add_type_name

@google_artifact('google.VertexModel')
class VertexModel(dsl.Artifact):
"""An artifact representing a Vertex Model."""
TYPE_NAME = 'google.VertexModel'

def __init__(self, name: str, uri: str, model_resource_name: str):
"""Args:
Expand All @@ -44,9 +56,9 @@ def __init__(self, name: str, uri: str, model_resource_name: str):
metadata={ARTIFACT_PROPERTY_KEY_RESOURCE_NAME: model_resource_name})


@google_artifact('google.VertexEndpoint')
class VertexEndpoint(dsl.Artifact):
"""An artifact representing a Vertex Endpoint."""
TYPE_NAME = 'google.VertexEndpoint'

def __init__(self, name: str, uri: str, endpoint_resource_name: str):
"""Args:
Expand All @@ -68,9 +80,9 @@ def __init__(self, name: str, uri: str, endpoint_resource_name: str):
metadata={ARTIFACT_PROPERTY_KEY_RESOURCE_NAME: endpoint_resource_name})


@google_artifact('google.VertexBatchPredictionJob')
class VertexBatchPredictionJob(dsl.Artifact):
"""An artifact representing a Vertex BatchPredictionJob."""
TYPE_NAME = 'google.VertexBatchPredictionJob'

def __init__(self,
name: str,
Expand Down Expand Up @@ -115,9 +127,9 @@ def __init__(self,
})


@google_artifact('google.VertexDataset')
class VertexDataset(dsl.Artifact):
"""An artifact representing a Vertex Dataset."""
TYPE_NAME = 'google.VertexDataset'

def __init__(self, name: str, uri: str, dataset_resource_name: str):
"""Args:
Expand All @@ -139,9 +151,9 @@ def __init__(self, name: str, uri: str, dataset_resource_name: str):
metadata={ARTIFACT_PROPERTY_KEY_RESOURCE_NAME: dataset_resource_name})


@google_artifact('google.BQMLModel')
class BQMLModel(dsl.Artifact):
"""An artifact representing a BQML Model."""
TYPE_NAME = 'google.BQMLModel'

def __init__(self, name: str, project_id: str, dataset_id: str,
model_id: str):
Expand All @@ -165,9 +177,9 @@ def __init__(self, name: str, project_id: str, dataset_id: str,
})


@google_artifact('google.BQTable')
class BQTable(dsl.Artifact):
"""An artifact representing a BQ Table."""
TYPE_NAME = 'google.BQTable'

def __init__(self, name: str, project_id: str, dataset_id: str,
table_id: str):
Expand All @@ -191,9 +203,9 @@ def __init__(self, name: str, project_id: str, dataset_id: str,
})


@google_artifact('google.UnmanagedContainerModel')
class UnmanagedContainerModel(dsl.Artifact):
"""An artifact representing an unmanaged container model."""
TYPE_NAME = 'google.UnmanagedContainerModel'

def __init__(self, predict_schemata: Dict, container_spec: Dict):
"""Args:
Expand Down

0 comments on commit 49de8d1

Please sign in to comment.