Skip to content

Commit

Permalink
SDK - Components - Stop serializing string values (#2227)
Browse files Browse the repository at this point in the history
This can happen with Lightweight component outputs if they've already been serialized manually.
  • Loading branch information
Ark-kun authored and k8s-ci-robot committed Sep 26, 2019
1 parent 342abae commit 7735a14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sdk/python/kfp/components/_data_passing.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def _deserialize_bool(s) -> bool:


def _serialize_json(obj) -> str:
if isinstance(obj, str):
return obj
import json
def default_serializer(obj):
if hasattr(obj, 'to_struct'):
Expand All @@ -55,6 +57,8 @@ def default_serializer(obj):


def _serialize_base64_pickle(obj) -> str:
if isinstance(obj, str):
return obj
import base64
import pickle
return base64.b64encode(pickle.dumps(obj)).decode('ascii')
Expand Down

0 comments on commit 7735a14

Please sign in to comment.