feat(sdk.v2): surface metrics output artifacts to pipeline outputs (#5445)

* populates metrics outputs in root

* avoid kfp import in io_types.py

* populates outputs following the right path
This commit is contained in:
Chen Sun 2021-04-09 16:37:04 -07:00 committed by GitHub
parent d8b2b24ed2
commit a80421191d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 928 additions and 823 deletions

View File

@ -184,6 +184,11 @@ class Artifact(object):
return serialization_utils.yaml_dump(result_map)
@classmethod
def get_ir_type(cls) -> pipeline_spec_pb2.ArtifactTypeSchema:
return pipeline_spec_pb2.ArtifactTypeSchema(
instance_schema=cls.get_artifact_type())
@classmethod
def get_from_runtime_artifact(
cls, artifact: pipeline_spec_pb2.RuntimeArtifact) -> Any:

View File

@ -61,8 +61,8 @@ def build_component_spec_from_structure(
input_spec.name].type = type_utils.get_parameter_type(input_spec.type)
else:
result.input_definitions.artifacts[
input_spec.name].artifact_type.instance_schema = (
type_utils.get_artifact_type_schema(input_spec.type))
input_spec.name].artifact_type.CopyFrom(
type_utils.get_artifact_type_schema_message(input_spec.type))
for output_spec in component_spec.outputs or []:
if type_utils.is_parameter_type(output_spec.type):
@ -71,8 +71,8 @@ def build_component_spec_from_structure(
output_spec.type)
else:
result.output_definitions.artifacts[
output_spec.name].artifact_type.instance_schema = (
type_utils.get_artifact_type_schema(output_spec.type))
output_spec.name].artifact_type.CopyFrom(
type_utils.get_artifact_type_schema_message(output_spec.type))
return result
@ -100,8 +100,8 @@ def build_component_inputs_spec(
elif input_name not in getattr(component_spec.input_definitions,
'parameters', []):
component_spec.input_definitions.artifacts[
input_name].artifact_type.instance_schema = (
type_utils.get_artifact_type_schema(param.param_type))
input_name].artifact_type.CopyFrom(
type_utils.get_artifact_type_schema_message(param.param_type))
def build_component_outputs_spec(
@ -122,8 +122,8 @@ def build_component_outputs_spec(
elif output_name not in getattr(component_spec.output_definitions,
'parameters', []):
component_spec.output_definitions.artifacts[
output_name].artifact_type.instance_schema = (
type_utils.get_artifact_type_schema(param.param_type))
output_name].artifact_type.CopyFrom(
type_utils.get_artifact_type_schema_message(param.param_type))
def build_task_inputs_spec(

View File

@ -1,4 +1,4 @@
title: kfp.ClassificationMetrics
title: system.ClassificationMetrics
type: object
properties:
auPrc:

View File

@ -1,4 +1,4 @@
title: kfp.Metrics
title: system.Metrics
type: object
properties:
accuracy:

View File

@ -17,20 +17,23 @@ from typing import Dict, List, Optional, Type, Union
from kfp.components import structures
from kfp.pipeline_spec import pipeline_spec_pb2
from kfp.dsl import artifact
from kfp.dsl import artifact_utils
from kfp.dsl import ontology_artifacts
from kfp.dsl import io_types
# ComponentSpec I/O types to (IR) PipelineTaskSpec I/O types mapping.
# The keys are normalized (lowercased). These are types viewed as Artifacts.
# The values are the corresponding IR artifact ontology types.
# TODO: migrate/merge other ontology_artifacts types to io_types
_ARTIFACT_TYPES_MAPPING = {
'model':
ontology_artifacts.Model.get_artifact_type(),
'dataset':
ontology_artifacts.Dataset.get_artifact_type(),
'metrics':
ontology_artifacts.Metrics.get_artifact_type(),
artifact_utils.read_schema_file('metrics.yaml'),
'classificationmetrics':
ontology_artifacts.ClassificationMetrics.get_artifact_type(),
artifact_utils.read_schema_file('classification_metrics.yaml'),
'slicedclassificationmetrics':
ontology_artifacts.SlicedClassificationMetrics.get_artifact_type(),
}
@ -42,9 +45,9 @@ _ARTIFACT_CLASSES_MAPPING = {
'dataset':
ontology_artifacts.Dataset,
'metrics':
ontology_artifacts.Metrics,
io_types.Metrics,
'classificationmetrics':
ontology_artifacts.ClassificationMetrics,
io_types.ClassificationMetrics,
'slicedclassificationmetrics':
ontology_artifacts.SlicedClassificationMetrics,
}
@ -106,8 +109,14 @@ def get_artifact_type_schema_message(
type_name: str) -> pipeline_spec_pb2.ArtifactTypeSchema:
"""Gets the IR I/O artifact type msg for the given ComponentSpec I/O type."""
if isinstance(type_name, str):
return _ARTIFACT_CLASSES_MAPPING.get(type_name.lower(),
artifact.Artifact).get_ir_type()
artifact_class = _ARTIFACT_CLASSES_MAPPING.get(type_name.lower(),
artifact.Artifact)
# TODO: migrate all types to system. namespace.
if artifact_class.TYPE_NAME.startswith('system.'):
return pipeline_spec_pb2.ArtifactTypeSchema(
schema_title=artifact_class.TYPE_NAME)
else:
return artifact_class.get_ir_type()
else:
return artifact.Artifact.get_ir_type()

View File

@ -40,9 +40,10 @@ class TypeUtilsTest(unittest.TestCase):
'title: kfp.Model' in type_utils.get_artifact_type_schema('Model'))
self.assertTrue(
'title: kfp.Dataset' in type_utils.get_artifact_type_schema('Dataset'))
print(type_utils.get_artifact_type_schema('Metrics'))
self.assertTrue(
'title: kfp.Metrics' in type_utils.get_artifact_type_schema('Metrics'))
self.assertTrue('title: kfp.ClassificationMetrics' in type_utils
'system.Metrics' in type_utils.get_artifact_type_schema('Metrics'))
self.assertTrue('system.ClassificationMetrics' in type_utils
.get_artifact_type_schema('ClassificationMetrics'))
self.assertTrue('title: kfp.SlicedClassificationMetrics' in type_utils
.get_artifact_type_schema('SlicedClassificationMetrics'))
@ -61,11 +62,11 @@ class TypeUtilsTest(unittest.TestCase):
'title: kfp.Dataset' in type_utils.get_artifact_type_schema_message(
'Dataset').instance_schema)
self.assertTrue(
'title: kfp.Metrics' in type_utils.get_artifact_type_schema_message(
'Metrics').instance_schema)
self.assertTrue('title: kfp.ClassificationMetrics' in
'system.Metrics' in type_utils.get_artifact_type_schema_message(
'Metrics').schema_title)
self.assertTrue('system.ClassificationMetrics' in
type_utils.get_artifact_type_schema_message(
'ClassificationMetrics').instance_schema)
'ClassificationMetrics').schema_title)
self.assertTrue('title: kfp.SlicedClassificationMetrics' in
type_utils.get_artifact_type_schema_message(
'SlicedClassificationMetrics').instance_schema)

View File

@ -35,6 +35,7 @@ from kfp.v2.compiler import compiler_utils
from kfp.dsl import component_spec as dsl_component_spec
from kfp.dsl import dsl_utils
from kfp.dsl import importer_node
from kfp.dsl import io_types
from kfp.dsl import type_utils
from kfp.pipeline_spec import pipeline_spec_pb2
@ -66,8 +67,8 @@ class Compiler(object):
kfp.v2.compiler.Compiler().compile(my_pipeline, 'path/to/pipeline.json')
"""
def _get_groups_for_ops(
self, root_group: dsl.OpsGroup) -> Dict[str, List[dsl.OpsGroup]]:
def _get_groups_for_ops(self,
root_group: dsl.OpsGroup) -> Dict[str, List[str]]:
"""Helper function to get groups that contain the specified ops.
Each pipeline has a root group. Each group has a list of operators (leaf)
@ -107,7 +108,7 @@ class Compiler(object):
#TODO: combine with the _get_groups_for_ops
def _get_groups_for_opsgroups(
self, root_group: dsl.OpsGroup) -> Dict[str, List[dsl.OpsGroup]]:
self, root_group: dsl.OpsGroup) -> Dict[str, List[str]]:
"""Helper function to get groups that contain the specified opsgroup.
Each pipeline has a root group. Each group has a list of operators (leaf)
@ -160,8 +161,8 @@ class Compiler(object):
def _get_uncommon_ancestors(
self,
op_groups: Dict[str, List[dsl.OpsGroup]],
opsgroup_groups: Dict[str, List[dsl.OpsGroup]],
op_groups: Dict[str, List[str]],
opsgroup_groups: Dict[str, List[str]],
op1: dsl.BaseOp,
op2: dsl.BaseOp,
) -> Tuple[List[_GroupOrOp], List[_GroupOrOp]]:
@ -260,8 +261,8 @@ class Compiler(object):
pipeline: dsl.Pipeline,
args: List[dsl.PipelineParam],
root_group: dsl.OpsGroup,
op_groups: Dict[str, List[dsl.OpsGroup]],
opsgroup_groups: Dict[str, List[dsl.OpsGroup]],
op_groups: Dict[str, List[str]],
opsgroup_groups: Dict[str, List[str]],
condition_params: Dict[str, dsl.PipelineParam],
op_name_to_for_loop_op: Dict[str, dsl.ParallelFor],
) -> Tuple[Dict[str, List[Tuple[dsl.PipelineParam, str]]], Dict[
@ -405,8 +406,8 @@ class Compiler(object):
self,
pipeline: dsl.Pipeline,
root_group: dsl.OpsGroup,
op_groups: Dict[str, dsl.OpsGroup],
opsgroups_groups: Dict[str, dsl.OpsGroup],
op_groups: Dict[str, List[str]],
opsgroups_groups: Dict[str, List[str]],
opsgroups: Dict[str, dsl.OpsGroup],
condition_params: Dict[str, dsl.PipelineParam],
) -> Dict[str, List[_GroupOrOp]]:
@ -625,6 +626,60 @@ class Compiler(object):
dsl_component_spec.pop_input_from_component_spec(group_component_spec,
loop_argument_name)
def _populate_metrics_in_dag_outputs(
self,
ops: List[dsl.ContainerOp],
op_to_parent_groups: Dict[str, List[str]],
pipeline_spec: pipeline_spec_pb2.PipelineSpec,
) -> None:
"""Populates metrics artifacts in dag outputs.
Args:
ops: The list of ops that may produce metrics outputs.
op_to_parent_groups: The dict of op name to parent groups. Key is the op's
name. Value is a list of ancestor groups including the op itself. The
list of a given op is sorted in a way that the farthest group is the
first and the op itself is the last.
pipeline_spec: The pipeline_spec to update in-place.
"""
for op in ops:
op_task_spec = getattr(op, 'task_spec',
pipeline_spec_pb2.PipelineTaskSpec())
op_component_spec = getattr(op, 'component_spec',
pipeline_spec_pb2.ComponentSpec())
# Get the component spec for all its parent groups.
parent_groups_component_specs = [pipeline_spec.root]
# skip the op itself and the root group which cannot be retrived via name.
for group_name in op_to_parent_groups[op.name][1:-1]:
component_name = dsl_utils.sanitize_component_name(group_name)
parent_groups_component_specs.append(
pipeline_spec.components[component_name])
# Reverse the order to make the farthest group in the end.
parent_groups_component_specs.reverse()
for output_name, artifact_spec in \
op_component_spec.output_definitions.artifacts.items():
if artifact_spec.artifact_type.WhichOneof(
'kind'
) == 'schema_title' and artifact_spec.artifact_type.schema_title in [
io_types.Metrics.TYPE_NAME,
io_types.ClassificationMetrics.TYPE_NAME,
]:
unique_output_name = '{}-{}'.format(op_task_spec.task_info.name,
output_name)
for group_component_spec in parent_groups_component_specs:
group_component_spec.output_definitions.artifacts[
unique_output_name].CopyFrom(artifact_spec)
group_component_spec.dag.outputs.artifacts[
unique_output_name].artifact_selectors.append(
pipeline_spec_pb2.DagOutputsSpec.ArtifactSelectorSpec(
producer_subtask=op_task_spec.task_info.name,
output_artifact_key=output_name,
))
def _group_to_dag_spec(
self,
group: dsl.OpsGroup,
@ -634,6 +689,7 @@ class Compiler(object):
pipeline_spec: pipeline_spec_pb2.PipelineSpec,
deployment_config: pipeline_spec_pb2.PipelineDeploymentConfig,
rootgroup_name: str,
op_to_parent_groups: Dict[str, List[str]],
) -> None:
"""Generate IR spec given an OpsGroup.
@ -649,6 +705,10 @@ class Compiler(object):
deployment_config: The deployment_config to hold all executors.
rootgroup_name: The name of the group root. Used to determine whether the
component spec for the current group should be the root dag.
op_to_parent_groups: The dict of op name to parent groups. Key is the op's
name. Value is a list of ancestor groups including the op itself. The
list of a given op is sorted in a way that the farthest group is the
first and the op itself is the last.
"""
group_component_name = dsl_utils.sanitize_component_name(group.name)
@ -664,6 +724,7 @@ class Compiler(object):
pipeline_spec_pb2.PipelineTaskSpec())
subgroup_component_spec = getattr(subgroup, 'component_spec',
pipeline_spec_pb2.ComponentSpec())
is_loop_subgroup = (isinstance(group, dsl.ParallelFor))
is_recursive_subgroup = (
isinstance(subgroup, dsl.OpsGroup) and subgroup.recursive_ref)
@ -874,6 +935,13 @@ class Compiler(object):
pipeline_spec.deployment_spec.update(
json_format.MessageToDict(deployment_config))
# Surface metrics outputs to the top.
self._populate_metrics_in_dag_outputs(
group.ops,
op_to_parent_groups,
pipeline_spec,
)
def _create_pipeline_spec(
self,
args: List[dsl.PipelineParam],
@ -940,6 +1008,7 @@ class Compiler(object):
pipeline_spec,
deployment_config,
root_group.name,
op_name_to_parent_groups,
)
return pipeline_spec

View File

@ -98,4 +98,4 @@ if __name__ == '__main__':
compiler.Compiler().compile(
pipeline_func=pipeline,
pipeline_root='dummy_root',
package_path=__file__ + '.json')
package_path=__file__.replace('.py', '.json'))

View File

@ -1,216 +1,15 @@
{
"pipelineSpec": {
"components": {
"comp-importer-task-upstream-input-7": {
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
},
"inputDefinitions": {
"parameters": {
"input_7": {
"type": "STRING"
}
}
},
"executorLabel": "exec-importer-task-upstream-input-7"
},
"comp-importer-task-upstream-input-5": {
"inputDefinitions": {
"parameters": {
"input_5": {
"type": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Metrics\ntype: object\nproperties:\n accuracy:\n type: number\n precision:\n type: number\n recall:\n type: number\n f1score:\n type: number\n mean_absolute_error:\n type: number\n mean_squared_error:\n type: number\n"
}
}
}
},
"executorLabel": "exec-importer-task-upstream-input-5"
},
"comp-importer-task-upstream-input-6": {
"inputDefinitions": {
"parameters": {
"input_6": {
"type": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
},
"executorLabel": "exec-importer-task-upstream-input-6"
},
"comp-importer-task-upstream-input-8": {
"executorLabel": "exec-importer-task-upstream-input-8",
"inputDefinitions": {
"parameters": {
"input_8": {
"type": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
}
},
"comp-upstream": {
"inputDefinitions": {
"artifacts": {
"input_4": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input_3": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input_6": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input_5": {
"artifactType": {
"instanceSchema": "title: kfp.Metrics\ntype: object\nproperties:\n accuracy:\n type: number\n precision:\n type: number\n recall:\n type: number\n f1score:\n type: number\n mean_absolute_error:\n type: number\n mean_squared_error:\n type: number\n"
}
},
"input_7": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input_8": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
},
"parameters": {
"input_1": {
"type": "STRING"
},
"input_2": {
"type": "DOUBLE"
}
}
},
"outputDefinitions": {
"artifacts": {
"output_3": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"output_2": {
"artifactType": {
"instanceSchema": "title: kfp.Model\ntype: object\nproperties:\n framework:\n type: string\n framework_version:\n type: string\n"
}
}
},
"parameters": {
"output_1": {
"type": "INT"
}
}
},
"executorLabel": "exec-upstream"
},
"comp-importer-task-upstream-input-4": {
"inputDefinitions": {
"parameters": {
"input_4": {
"type": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
},
"executorLabel": "exec-importer-task-upstream-input-4"
},
"comp-importer-task-upstream-input-3": {
"executorLabel": "exec-importer-task-upstream-input-3",
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
},
"inputDefinitions": {
"parameters": {
"input_3": {
"type": "STRING"
}
}
}
},
"comp-downstream": {
"inputDefinitions": {
"artifacts": {
"input_c": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input_b": {
"artifactType": {
"instanceSchema": "title: kfp.Model\ntype: object\nproperties:\n framework:\n type: string\n framework_version:\n type: string\n"
}
}
},
"parameters": {
"input_a": {
"type": "INT"
}
}
},
"executorLabel": "exec-downstream"
}
},
"schemaVersion": "2.0.0",
"root": {
"dag": {
"tasks": {
"task-importer-task-upstream-input-4": {
"task-importer-task-upstream-input-6": {
"taskInfo": {
"name": "task-importer-task-upstream-input-4"
"name": "task-importer-task-upstream-input-6"
},
"componentRef": {
"name": "comp-importer-task-upstream-input-4"
"name": "comp-importer-task-upstream-input-6"
}
},
"task-importer-task-upstream-input-8": {
@ -221,32 +20,13 @@
"name": "comp-importer-task-upstream-input-8"
}
},
"task-importer-task-upstream-input-3": {
"componentRef": {
"name": "comp-importer-task-upstream-input-3"
},
"taskInfo": {
"name": "task-importer-task-upstream-input-3"
}
},
"task-importer-task-upstream-input-6": {
"taskInfo": {
"name": "task-importer-task-upstream-input-6"
},
"componentRef": {
"name": "comp-importer-task-upstream-input-6"
}
},
"task-downstream": {
"taskInfo": {
"name": "task-downstream"
},
"dependentTasks": [
"task-upstream"
],
"componentRef": {
"name": "comp-downstream"
},
"taskInfo": {
"name": "task-downstream"
},
"inputs": {
"artifacts": {
"input_b": {
@ -265,53 +45,26 @@
"parameters": {
"input_a": {
"taskOutputParameter": {
"outputParameterKey": "output_1",
"producerTask": "task-upstream"
"producerTask": "task-upstream",
"outputParameterKey": "output_1"
}
}
}
},
"dependentTasks": [
"task-upstream"
]
},
"task-importer-task-upstream-input-4": {
"taskInfo": {
"name": "task-importer-task-upstream-input-4"
},
"componentRef": {
"name": "comp-importer-task-upstream-input-4"
}
},
"task-upstream": {
"inputs": {
"artifacts": {
"input_5": {
"taskOutputArtifact": {
"producerTask": "task-importer-task-upstream-input-5",
"outputArtifactKey": "result"
}
},
"input_4": {
"taskOutputArtifact": {
"producerTask": "task-importer-task-upstream-input-4",
"outputArtifactKey": "result"
}
},
"input_7": {
"taskOutputArtifact": {
"producerTask": "task-importer-task-upstream-input-7",
"outputArtifactKey": "result"
}
},
"input_3": {
"taskOutputArtifact": {
"producerTask": "task-importer-task-upstream-input-3",
"outputArtifactKey": "result"
}
},
"input_8": {
"taskOutputArtifact": {
"producerTask": "task-importer-task-upstream-input-8",
"outputArtifactKey": "result"
}
},
"input_6": {
"taskOutputArtifact": {
"outputArtifactKey": "result",
"producerTask": "task-importer-task-upstream-input-6"
}
}
},
"parameters": {
"input_1": {
"componentInputParameter": "input1"
@ -323,6 +76,44 @@
}
}
}
},
"artifacts": {
"input_6": {
"taskOutputArtifact": {
"outputArtifactKey": "result",
"producerTask": "task-importer-task-upstream-input-6"
}
},
"input_5": {
"taskOutputArtifact": {
"producerTask": "task-importer-task-upstream-input-5",
"outputArtifactKey": "result"
}
},
"input_4": {
"taskOutputArtifact": {
"outputArtifactKey": "result",
"producerTask": "task-importer-task-upstream-input-4"
}
},
"input_3": {
"taskOutputArtifact": {
"outputArtifactKey": "result",
"producerTask": "task-importer-task-upstream-input-3"
}
},
"input_8": {
"taskOutputArtifact": {
"producerTask": "task-importer-task-upstream-input-8",
"outputArtifactKey": "result"
}
},
"input_7": {
"taskOutputArtifact": {
"outputArtifactKey": "result",
"producerTask": "task-importer-task-upstream-input-7"
}
}
}
},
"componentRef": {
@ -347,63 +138,59 @@
"componentRef": {
"name": "comp-importer-task-upstream-input-5"
}
},
"task-importer-task-upstream-input-3": {
"taskInfo": {
"name": "task-importer-task-upstream-input-3"
},
"componentRef": {
"name": "comp-importer-task-upstream-input-3"
}
}
}
},
"inputDefinitions": {
"parameters": {
"input1": {
"type": "STRING"
}
},
"artifacts": {
"input7": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input3": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input6": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input4": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input8": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input3": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input7": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input5": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input4": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
},
"parameters": {
"input1": {
"type": "STRING"
}
}
}
},
"schemaVersion": "2.0.0",
"sdkVersion": "kfp-1.4.1",
"deploymentSpec": {
"executors": {
"exec-downstream": {
"container": {
"image": "gcr.io/image",
"args": [
"{{$.inputs.parameters['input_a']}}",
"{{$.inputs.artifacts['input_b'].uri}}",
"{{$.inputs.artifacts['input_c'].path}}"
]
}
},
"exec-importer-task-upstream-input-3": {
"importer": {
"typeSchema": {
@ -414,46 +201,14 @@
}
}
},
"exec-importer-task-upstream-input-6": {
"importer": {
"artifactUri": {
"runtimeParameter": "input6"
},
"typeSchema": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
},
"exec-importer-task-upstream-input-8": {
"importer": {
"typeSchema": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
},
"artifactUri": {
"runtimeParameter": "input8"
}
}
},
"exec-importer-task-upstream-input-5": {
"importer": {
"artifactUri": {
"constantValue": {
"stringValue": "gs://bucket/metrics"
}
},
"typeSchema": {
"instanceSchema": "title: kfp.Metrics\ntype: object\nproperties:\n accuracy:\n type: number\n precision:\n type: number\n recall:\n type: number\n f1score:\n type: number\n mean_absolute_error:\n type: number\n mean_squared_error:\n type: number\n"
}
}
},
"exec-importer-task-upstream-input-4": {
"importer": {
"typeSchema": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
},
"artifactUri": {
"runtimeParameter": "input4"
}
"exec-downstream": {
"container": {
"image": "gcr.io/image",
"args": [
"{{$.inputs.parameters['input_a']}}",
"{{$.inputs.artifacts['input_b'].uri}}",
"{{$.inputs.artifacts['input_c'].path}}"
]
}
},
"exec-upstream": {
@ -474,6 +229,16 @@
"image": "gcr.io/image"
}
},
"exec-importer-task-upstream-input-4": {
"importer": {
"typeSchema": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
},
"artifactUri": {
"runtimeParameter": "input4"
}
}
},
"exec-importer-task-upstream-input-7": {
"importer": {
"artifactUri": {
@ -483,11 +248,246 @@
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
},
"exec-importer-task-upstream-input-5": {
"importer": {
"typeSchema": {
"instanceSchema": "title: kfp.Model\ntype: object\nproperties:\n framework:\n type: string\n framework_version:\n type: string\n"
},
"artifactUri": {
"constantValue": {
"stringValue": "gs://bucket/metrics"
}
}
}
},
"exec-importer-task-upstream-input-6": {
"importer": {
"typeSchema": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
},
"artifactUri": {
"runtimeParameter": "input6"
}
}
},
"exec-importer-task-upstream-input-8": {
"importer": {
"artifactUri": {
"runtimeParameter": "input8"
},
"typeSchema": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
}
},
"pipelineInfo": {
"name": "pipeline-with-various-types"
},
"sdkVersion": "kfp-1.5.0-rc.2",
"components": {
"comp-importer-task-upstream-input-7": {
"inputDefinitions": {
"parameters": {
"input_7": {
"type": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
},
"executorLabel": "exec-importer-task-upstream-input-7"
},
"comp-upstream": {
"inputDefinitions": {
"parameters": {
"input_1": {
"type": "STRING"
},
"input_2": {
"type": "DOUBLE"
}
},
"artifacts": {
"input_8": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input_6": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input_4": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input_5": {
"artifactType": {
"instanceSchema": "title: kfp.Model\ntype: object\nproperties:\n framework:\n type: string\n framework_version:\n type: string\n"
}
},
"input_7": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input_3": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
},
"outputDefinitions": {
"artifacts": {
"output_3": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"output_2": {
"artifactType": {
"instanceSchema": "title: kfp.Model\ntype: object\nproperties:\n framework:\n type: string\n framework_version:\n type: string\n"
}
}
},
"parameters": {
"output_1": {
"type": "INT"
}
}
},
"executorLabel": "exec-upstream"
},
"comp-importer-task-upstream-input-4": {
"executorLabel": "exec-importer-task-upstream-input-4",
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
},
"inputDefinitions": {
"parameters": {
"input_4": {
"type": "STRING"
}
}
}
},
"comp-downstream": {
"executorLabel": "exec-downstream",
"inputDefinitions": {
"artifacts": {
"input_c": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
},
"input_b": {
"artifactType": {
"instanceSchema": "title: kfp.Model\ntype: object\nproperties:\n framework:\n type: string\n framework_version:\n type: string\n"
}
}
},
"parameters": {
"input_a": {
"type": "INT"
}
}
}
},
"comp-importer-task-upstream-input-5": {
"executorLabel": "exec-importer-task-upstream-input-5",
"inputDefinitions": {
"parameters": {
"input_5": {
"type": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Model\ntype: object\nproperties:\n framework:\n type: string\n framework_version:\n type: string\n"
}
}
}
}
},
"comp-importer-task-upstream-input-6": {
"executorLabel": "exec-importer-task-upstream-input-6",
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
},
"inputDefinitions": {
"parameters": {
"input_6": {
"type": "STRING"
}
}
}
},
"comp-importer-task-upstream-input-3": {
"executorLabel": "exec-importer-task-upstream-input-3",
"inputDefinitions": {
"parameters": {
"input_3": {
"type": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
}
},
"comp-importer-task-upstream-input-8": {
"executorLabel": "exec-importer-task-upstream-input-8",
"inputDefinitions": {
"parameters": {
"input_8": {
"type": "STRING"
}
}
},
"outputDefinitions": {
"artifacts": {
"result": {
"artifactType": {
"instanceSchema": "title: kfp.Artifact\ntype: object\n"
}
}
}
}
}
}
},
"runtimeConfig": {
@ -495,16 +495,16 @@
"input7": {
"stringValue": "arbitrary value"
},
"input8": {
"stringValue": "gs://path2"
},
"input5": {
"stringValue": "gs://bucket/metrics"
"stringValue": "gs://bucket/model"
},
"input6": {
"stringValue": "gs://bucket/dataset"
},
"input8": {
"stringValue": "gs://path2"
}
},
"gcsOutputDirectory": "dummy_root"
}
}
}

View File

@ -25,7 +25,7 @@ inputs:
- {name: input_2, type: Float}
- {name: input_3, type: }
- {name: input_4}
- {name: input_5, type: Metrics}
- {name: input_5, type: Model}
- {name: input_6, type: Datasets}
- {name: input_7, type: Some arbitrary type}
- {name: input_8, type: {GcsPath: {data_type: TSV}}}
@ -70,7 +70,7 @@ implementation:
def my_pipeline(input1: str,
input3,
input4='',
input5='gs://bucket/metrics',
input5='gs://bucket/model',
input6='gs://bucket/dataset',
input7='arbitrary value',
input8='gs://path2'):

View File

@ -49,6 +49,6 @@
}
},
"type": {
"instanceSchema": "title: kfp.ClassificationMetrics\ntype: object\nproperties:\n auPrc:\n type: number\n format: float\n auRoc:\n type: number\n format: float\n logLoss:\n type: number\n format: float\n confidenceMetrics:\n type: array\n items:\n type: object\n properties:\n confidenceThreshold:\n type: number\n format: float\n maxPredictions:\n type: integer\n format: int32\n recall:\n type: number\n format: float\n precision:\n type: number\n format: float\n falsePositiveRate:\n type: number\n format: float\n f1Score:\n type: number\n format: float\n recallAt1:\n type: number\n format: float\n precisionAt1:\n type: number\n format: float\n falsePositiveRateAt1:\n type: number\n format: float\n f1ScoreAt1:\n type: number\n format: float\n truePositiveCount:\n type: integer\n format: int64\n falsePositiveCount:\n type: integer\n format: int64\n falseNegativeCount:\n type: integer\n format: int64\n trueNegativeCount:\n type: integer\n format: int64\n confusionMatrix:\n type: object\n properties:\n annotationSpecs:\n type: array\n items:\n type: object\n properties:\n id:\n type: string\n displayName:\n type: string\n rows:\n type: array\n items:\n type: object\n properties:\n row:\n type: array\n items:\n type: integer\n format: int64\n"
"instanceSchema": "title: system.ClassificationMetrics\ntype: object\nproperties:\n auPrc:\n type: number\n format: float\n auRoc:\n type: number\n format: float\n logLoss:\n type: number\n format: float\n confidenceMetrics:\n type: array\n items:\n type: object\n properties:\n confidenceThreshold:\n type: number\n format: float\n maxPredictions:\n type: integer\n format: int32\n recall:\n type: number\n format: float\n precision:\n type: number\n format: float\n falsePositiveRate:\n type: number\n format: float\n f1Score:\n type: number\n format: float\n recallAt1:\n type: number\n format: float\n precisionAt1:\n type: number\n format: float\n falsePositiveRateAt1:\n type: number\n format: float\n f1ScoreAt1:\n type: number\n format: float\n truePositiveCount:\n type: integer\n format: int64\n falsePositiveCount:\n type: integer\n format: int64\n falseNegativeCount:\n type: integer\n format: int64\n trueNegativeCount:\n type: integer\n format: int64\n confusionMatrix:\n type: object\n properties:\n annotationSpecs:\n type: array\n items:\n type: object\n properties:\n id:\n type: string\n displayName:\n type: string\n rows:\n type: array\n items:\n type: object\n properties:\n row:\n type: array\n items:\n type: integer\n format: int64\n"
}
}

View File

@ -41,6 +41,6 @@
},
"name" : "test_me",
"type": {
"instanceSchema": "title: kfp.ClassificationMetrics\ntype: object\nproperties:\n auPrc:\n type: number\n format: float\n auRoc:\n type: number\n format: float\n logLoss:\n type: number\n format: float\n confidenceMetrics:\n type: array\n items:\n type: object\n properties:\n confidenceThreshold:\n type: number\n format: float\n maxPredictions:\n type: integer\n format: int32\n recall:\n type: number\n format: float\n precision:\n type: number\n format: float\n falsePositiveRate:\n type: number\n format: float\n f1Score:\n type: number\n format: float\n recallAt1:\n type: number\n format: float\n precisionAt1:\n type: number\n format: float\n falsePositiveRateAt1:\n type: number\n format: float\n f1ScoreAt1:\n type: number\n format: float\n truePositiveCount:\n type: integer\n format: int64\n falsePositiveCount:\n type: integer\n format: int64\n falseNegativeCount:\n type: integer\n format: int64\n trueNegativeCount:\n type: integer\n format: int64\n confusionMatrix:\n type: object\n properties:\n annotationSpecs:\n type: array\n items:\n type: object\n properties:\n id:\n type: string\n displayName:\n type: string\n rows:\n type: array\n items:\n type: object\n properties:\n row:\n type: array\n items:\n type: integer\n format: int64\n"
"instanceSchema": "title: system.ClassificationMetrics\ntype: object\nproperties:\n auPrc:\n type: number\n format: float\n auRoc:\n type: number\n format: float\n logLoss:\n type: number\n format: float\n confidenceMetrics:\n type: array\n items:\n type: object\n properties:\n confidenceThreshold:\n type: number\n format: float\n maxPredictions:\n type: integer\n format: int32\n recall:\n type: number\n format: float\n precision:\n type: number\n format: float\n falsePositiveRate:\n type: number\n format: float\n f1Score:\n type: number\n format: float\n recallAt1:\n type: number\n format: float\n precisionAt1:\n type: number\n format: float\n falsePositiveRateAt1:\n type: number\n format: float\n f1ScoreAt1:\n type: number\n format: float\n truePositiveCount:\n type: integer\n format: int64\n falsePositiveCount:\n type: integer\n format: int64\n falseNegativeCount:\n type: integer\n format: int64\n trueNegativeCount:\n type: integer\n format: int64\n confusionMatrix:\n type: object\n properties:\n annotationSpecs:\n type: array\n items:\n type: object\n properties:\n id:\n type: string\n displayName:\n type: string\n rows:\n type: array\n items:\n type: object\n properties:\n row:\n type: array\n items:\n type: integer\n format: int64\n"
}
}

View File

@ -7,6 +7,6 @@
},
"name": "test_artifact",
"type": {
"instanceSchema": "title: kfp.Metrics\ntype: object\nproperties:\n accuracy:\n type: number\n precision:\n type: number\n recall:\n type: number\n f1score:\n type: number\n mean_absolute_error:\n type: number\n mean_squared_error:\n type: number\n"
"instanceSchema": "title: system.Metrics\ntype: object\nproperties:\n accuracy:\n type: number\n precision:\n type: number\n recall:\n type: number\n f1score:\n type: number\n mean_absolute_error:\n type: number\n mean_squared_error:\n type: number\n"
}
}