Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK - Compiler - Using properly serialized pipeline parameter defaults #3832

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions sdk/python/kfp/compiler/compiler.py
Expand Up @@ -812,11 +812,10 @@ def _create_workflow(self,
# Fill in the default values.
args_list_with_defaults = []
if pipeline_meta.inputs:
args_list_with_defaults = [dsl.PipelineParam(sanitize_k8s_name(arg_name, True))
for arg_name in argspec.args]
if argspec.defaults:
for arg, default in zip(reversed(args_list_with_defaults), reversed(argspec.defaults)):
arg.value = default.value if isinstance(default, dsl.PipelineParam) else default
args_list_with_defaults = [
dsl.PipelineParam(sanitize_k8s_name(input_spec.name, True), value=input_spec.default)
for input_spec in pipeline_meta.inputs
]
elif params_list:
# Or, if args are provided by params_list, fill in pipeline_meta.
for param in params_list:
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/kfp/components/_data_passing.py
Expand Up @@ -83,7 +83,7 @@ def default_serializer(obj):
return obj.to_struct()
else:
raise TypeError("Object of type '%s' is not JSON serializable and does not have .to_struct() method." % obj.__class__.__name__)
return json.dumps(obj, default=default_serializer)
return json.dumps(obj, default=default_serializer, sort_keys=True)


def _serialize_base64_pickle(obj) -> str:
Expand Down