Skip to content

Commit

Permalink
release notes + test
Browse files Browse the repository at this point in the history
  • Loading branch information
ji-yaqi committed Oct 6, 2021
1 parent 953ac67 commit 7128973
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions sdk/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

## Bug Fixes and Other Changes

* update v2 yaml format [\#6661](https://github.com/kubeflow/pipelines/pull/6661)

## Documentation Updates

# 1.8.4
Expand Down
21 changes: 11 additions & 10 deletions sdk/python/kfp/v2/components/experimental/component_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
import itertools
import json
from typing import Any, Dict, Mapping, Optional, Sequence, Union
try:
from typing import OrderedDict
except ImportError:
from collections import OrderedDict

from kfp.components import _components
from kfp.components import structures
import pydantic
Expand Down Expand Up @@ -136,8 +133,8 @@ class IfPresentPlaceholderStructure(BaseModel):
then: Sequence[ValidCommandArgs]
otherwise: Optional[Sequence[ValidCommandArgs]] = None

@pydantic.validator('otherwise')
def empty_sequence(cls, v):
@pydantic.validator('otherwise', allow_reuse=True)
def empty_otherwise_sequence(cls, v):
if v == []:
return None
return v
Expand Down Expand Up @@ -191,13 +188,13 @@ class ContainerSpec(BaseModel):
env: Optional[Mapping[str, ValidCommandArgs]] = None
resources: Optional[ResourceSpec] = None

@pydantic.validator('commands', 'arguments')
@pydantic.validator('commands', 'arguments', allow_reuse=True)
def empty_sequence(cls, v):
if v == []:
return None
return v

@pydantic.validator('env')
@pydantic.validator('env', allow_reuse=True)
def empty_map(cls, v):
if v == {}:
return None
Expand Down Expand Up @@ -286,20 +283,24 @@ class ComponentSpec(BaseModel):
implementation: The implementation of the component. Either an executor
(container, importer) or a DAG consists of other components.
"""
try:
from typing import OrderedDict
except:
from typing import MutableMapping as OrderedDict

name: str
description: Optional[str] = None
inputs: Optional[OrderedDict[str, InputSpec]] = None
outputs: Optional[OrderedDict[str, OutputSpec]] = None
implementation: Implementation

@pydantic.validator('inputs', 'outputs')
@pydantic.validator('inputs', 'outputs', allow_reuse=True)
def empty_map(cls, v):
if v == {}:
return None
return v

@pydantic.root_validator
@pydantic.root_validator(allow_reuse=True)
def validate_placeholders(cls, values):
if values.get('implementation').container is None:
return values
Expand Down

0 comments on commit 7128973

Please sign in to comment.