Skip to content

Commit

Permalink
SDK - Lightweigh - Made wrapper code compatible with python2 (#2035)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ark-kun authored and k8s-ci-robot committed Sep 13, 2019
1 parent f21d3ed commit 77d0ee0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sdk/python/kfp/components/_python_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,14 @@ def get_deserializer_and_register_definitions(type_name):
if not hasattr(_outputs, '__getitem__') or isinstance(_outputs, str):
_outputs = [_outputs]
from pathlib import Path
for idx, filename in enumerate(_output_files):
_output_path = Path(filename)
_output_path.parent.mkdir(parents=True, exist_ok=True)
_output_path.write_text(str(_outputs[idx]))
import os
for idx, output_file in enumerate(_output_files):
try:
os.makedirs(os.path.dirname(output_file))
except OSError:
pass
with open(output_file, 'w') as f:
f.write(str(_outputs[idx]))
'''.format(
func_name=func.__name__,
func_code=func_code,
Expand Down

0 comments on commit 77d0ee0

Please sign in to comment.