Skip to content

Commit

Permalink
SDK - Only install cloudpickle if it's not available (#1434)
Browse files Browse the repository at this point in the history
This makes unit tests much faster.
Also:
Pined the version to 1.1.1.
Made the installation quiet.
  • Loading branch information
Ark-kun authored and k8s-ci-robot committed Jun 5, 2019
1 parent f7eb0cc commit ab97d57
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sdk/python/kfp/components/_python_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ def _capture_function_code_using_cloudpickle(func) -> str:
func_code = '{func_name} = pickle.loads({func_pickle})'.format(func_name=func.__name__, func_pickle=repr(func_pickle))

code_lines = [
'import subprocess',
'import sys',
'subprocess.call([sys.executable, "-m", "pip", "install", "cloudpickle"])'
'try:',
' import cloudpickle as _cloudpickle',
'except ImportError:',
' import subprocess',
' import sys',
' subprocess.call([sys.executable, "-m", "pip", "install", "cloudpickle==1.1.1", "--quiet"])'
'',
'import pickle',
'',
Expand Down

0 comments on commit ab97d57

Please sign in to comment.