Migration from Flyte 1 to Flyte 2

An LLM-optimized bundle of this entire section is available at section.md. This single file contains all pages in this section, optimized for AI coding agent context.

This section provides a comprehensive reference for migrating Flyte 1 (flytekit) workflows to Flyte 2 (flyte SDK).

For a quick-start overview of the migration process, see Migration in the User Guide.

Key API changes at a glance

Use case Flyte 1 Flyte 2
Environment management N/A TaskEnvironment
Perform basic computation @task @env.task
Combine tasks into a workflow @workflow @env.task
Create dynamic workflows @dynamic @env.task
Fanout parallelism flytekit.map Python for loop with asyncio.gather
Conditional execution flytekit.conditional Python if-elif-else
Catching workflow failures @workflow(on_failure=...) Python try-except

Topics

Philosophy and imports
Key paradigm shifts and package import mapping from flytekit to flyte.
Container images
Migrate from ImageSpec to flyte.Image with the fluent builder API.
Configuration and CLI
Config file format changes and CLI command mapping.
Tasks and workflows
Migrate @task, @workflow, and @dynamic to TaskEnvironment and @env.task.
Secrets, resources, and caching
Updated patterns for secrets access, resource configuration, and caching.
Parallelism and async
Migrate map_task to flyte.map and asyncio.gather patterns.
Triggers and dynamic workflows
Migrate LaunchPlan schedules to Triggers and @dynamic to regular tasks.
Examples and common gotchas
Complete migration examples and common pitfalls to avoid.