square-agency-59624
10/12/2025, 12:01 AMancient-wolf-19325
10/12/2025, 12:01 AMflyte.io.File or FlyteFile type as the task input. When you pass a local file, it is uploaded to the Flyte blob store and referenced by the task; for remote files (e.g., S3, HTTP), Flyte uses the URI directly. In the task, you can access the file using the .open() method or the .path attribute. Example:
from flyte.io import File
import flyte
env = flyte.TaskEnvironment(name="files")
@env.task
async def process_file(input_file: File):
async with input_file.open() as f:
data = f.read()
# process data
or with FlyteFile:
from flytekit import task, workflow
from flytekit.types.file import FlyteFile
@task
def process_file(input_file: FlyteFile):
with open(input_file, "r") as f:
data = f.read()
# process data
You can pass a local file path or a remote URI when launching the workflow or task. For more, see Flyte files and directories and FlyteFile API reference.
Would you like more detail or examples for specific file types or use cases?
Sources:
- Flyte files and directories
- FlyteFile API reference 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.square-agency-59624
10/12/2025, 12:20 AMsquare-agency-59624
10/12/2025, 12:21 AMancient-wolf-19325
10/12/2025, 12:21 AMflyte.io.File or FlyteFile, you can pass a file as a string path (e.g., str or os.PathLike) to a task, but this disables Flyte's automatic upload/download and tracking—it's just a local file reference and won't work for remote execution or data sharing between tasks. For container tasks, you can also use input/output directories (e.g., /var/inputs, /var/outputs) and manage files manually inside the container, but this is more error-prone and less portable than using Flyte's file abstractions. See FlyteFile documentation and container interface docs.
Would you like a step-by-step example of using container task file I/O or more on manual file handling?
Sources:
- FlyteFile documentation
- Container interface docs 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.