sparse-advantage-22780
10/19/2023, 6:45 PMpyflyte run
handle files? like if the input to a workflow is a file, how should I go about that?sparse-advantage-22780
10/19/2023, 6:45 PMfrom flytekit import workflow, task
from flytekit.types.file import FlyteFile
@task
def task_long(f_in: FlyteFile) -> int:
data = f_in.open("r").read()
print(data)
ret = len(data)
return ret
@workflow
def runme(input_file: FlyteFile) -> int:
return task_long(input_file)
run:
$ pyflyte run --remote tmptest.py runme --input_file ./1ycr.pdb
Failed with Exception Code: USER:AssertionError
Underlying Exception: When calling tasks, only keyword args are supported. Aborting execution as detected 1 positional args (Promise(node:.input_file),)
Error encountered while executing 'runme':
When calling tasks, only keyword args are supported. Aborting execution as detected 1 positional args (Promise(node:.input_file),)
sparse-advantage-22780
10/19/2023, 6:50 PMsparse-advantage-22780
10/19/2023, 6:51 PMfrom flytekit import workflow, task, dynamic
from flytekit.types.file import FlyteFile
@task
def task_long(f_in: FlyteFile) -> int:
with f_in.open("r") as fh:
data = fh.read()
print(data)
ret = len(data)
return ret
@workflow
def runme(input_file: FlyteFile) -> int:
return task_long(f_in=input_file)
freezing-airport-6809
freezing-airport-6809
freezing-airport-6809
sparse-advantage-22780
10/19/2023, 9:31 PM