Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion flytekit/interaction/click_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ class FileParamType(click.ParamType):
def convert(
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

return value

# set remote_directory to false if running pyflyte run locally. This makes sure that the original
# file is used and not a random one.
remote_path = None if getattr(ctx.obj, "is_remote", False) else False
Expand All @@ -177,6 +178,7 @@ class PickleParamType(click.ParamType):

def get_metavar(self, param: Parameter, ctx: Context) -> t.Optional[str]:
return "Python Object <Module>:<Object>"

else:

def get_metavar(self, param: Parameter, *args) -> t.Optional[str]:
Expand Down