Skip to content

Commit

Permalink
refactor(click_types): skip serialization for default values (flyteor…
Browse files Browse the repository at this point in the history
…g#2418)

Signed-off-by: Kevin Su <[email protected]>
  • Loading branch information
pingsutw authored May 15, 2024
1 parent 1ca3d91 commit 76fb7c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flytekit/clis/sdk_in_container/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ def _run(*args, **kwargs):
raise click.UsageError(
f"Default for '{input_name}' is a query, which must be specified when running locally."
)
inputs[input_name] = processed_click_value
if processed_click_value is not None:
inputs[input_name] = processed_click_value

if not run_level_params.is_remote:
with FlyteContextManager.with_context(_update_flyte_context(run_level_params)):
Expand Down
3 changes: 3 additions & 0 deletions flytekit/interaction/click_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ def convert(
if self._python_type is datetime.date:
# Click produces datetime, so converting to date to avoid type mismatch error
value = value.date()
# If the input matches the default value in the launch plan, serialization can be skipped.
if param and value == param.default:
return None
lit = TypeEngine.to_literal(self._flyte_ctx, value, self._python_type, self._literal_type)

if not self._is_remote:
Expand Down

0 comments on commit 76fb7c3

Please sign in to comment.