Skip to content

Conversation

@machichima
Copy link
Member

@machichima machichima commented Aug 24, 2025

Tracking issue

Why are the changes needed?

When running local workflow with the default args value set as FlyteFile, we will get following error:

image

What changes were proposed in this pull request?

  1. In FileParamType's convert function, if the value is already FlyteFile, directly return value to prevent creating the nested FlyteFile

How was this patch tested?

Test by running script:

DEFAULT_LOCAL_PATH = "./test.txt"

@task
def my_task(dataset: FlyteFile):
    print(f"path: {dataset.path}")

@workflow
def wf(file: FlyteFile = FlyteFile(DEFAULT_LOCAL_PATH)):
    outputs = my_task(dataset=file)

Setup process

Screenshots

Result after my modification

image

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Summary by Bito

This pull request fixes a bug in handling default `FlyteFile` values in workflows by modifying the `convert` function in the `FileParamType` class. It ensures that existing `FlyteFile` instances are returned directly without nesting, allowing local workflows to execute smoothly with `FlyteFile` as a default argument.

self, value: typing.Any, param: typing.Optional[click.Parameter], ctx: typing.Optional[click.Context]
) -> typing.Any:
if isinstance(value, ArtifactQuery):
if isinstance(value, (ArtifactQuery, FlyteFile)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to update DirParamType for FlyteDirectory?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I'll open a follow-up PR for updating DirParamType

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like FlyteDirectory will not have this issue 🤔
Following works

def my_task(dataset: FlyteDirectory):
    print(f"path: {dataset.path}")


@workflow
def wf(dir: FlyteDirectory = FlyteDirectory(DEFAULT_LOCAL_DIR)):
    outputs = my_task(dataset=dir)

image

@machichima machichima force-pushed the flytefile-default-value branch from d8fe46d to c7014ac Compare August 27, 2025 04:14
@flyte-bot
Copy link
Contributor

Bito Automatic Review Failed - Technical Failure

Bito encountered technical difficulties while generating code feedback . To retry, type /review in a comment and save. If the issue persists, contact [email protected] and provide the following details:

Agent Run ID: b8413387-220d-40e3-961b-f216fed3e7ea

@codecov
Copy link

codecov bot commented Aug 29, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 52.64%. Comparing base (bcdfaae) to head (c7014ac).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
flytekit/interaction/click_types.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3322   +/-   ##
=======================================
  Coverage   52.64%   52.64%           
=======================================
  Files         215      215           
  Lines       22543    22544    +1     
  Branches     2950     2950           
=======================================
+ Hits        11868    11869    +1     
  Misses       9968     9968           
  Partials      707      707           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pingsutw pingsutw merged commit e8df37f into flyteorg:master Sep 23, 2025
448 of 456 checks passed
Atharva1723 pushed a commit to Atharva1723/flytekit that referenced this pull request Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants