<#3322 [Fix] Error when using FlyteFile as default...
# flyte-github
a
#3322 [Fix] Error when using FlyteFile as default value in workflow Pull request opened by machichima ## 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](https://private-user-images.githubusercontent.com/60069744/481342158-e46a7f49-1331-428a-9d1f-3999d952c385.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTg2NjY1MzcsIm5iZiI6MTc1ODY2NjIzNywicGF0aCI6Ii82MDA2OTc0NC80ODEzNDIxNTgtZTQ2YTdmNDktMTMzMS00MjhhLTlkMWYtMzk5OWQ5NTJjMzg1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA5MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwOTIzVDIyMjM1N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ5MGFiMGJjN2FmZWNmYTg3NDZkNzQ3NGZlYzMxNjQzOTFmZGFjOTA0YzA0ZWM3NmU3ZDllNzYyODhiMDRiYTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.O35y7GCf4nNuSXVwIYIolw1hHqNNmmLNHNbmLdRz0iQ) ## 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](https://private-user-images.githubusercontent.com/60069744/481342421-62bdd7c5-7889-43cf-afd0-dbdd66aee318.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTg2NjY1MzcsIm5iZiI6MTc1ODY2NjIzNywicGF0aCI6Ii82MDA2OTc0NC80ODEzNDI0MjEtNjJiZGQ3YzUtNzg4OS00M2NmLWFmZDAtZGJkZDY2YWVlMzE4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA5MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwOTIzVDIyMjM1N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJlZmVhNDgwNmE4NmQ3ODI4ZmFhYjE3NDY5YWEwNTkxZmUxY2UyOTM0YzUyMGRhMjQxMGJlZTliNmU0MGM3ZGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.KwJK3bE9EuP8PLy4zs4QsRo7ro6gblRZZZlH3PBNM_c) ## 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 https://bito.ai#summarystart| ### 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. flyteorg/flytekit