Skip to content
Draft
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions content/user-guide/flyte-2/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Flyte 2 and Union 2 represent a fundamental shift in how workflows are written a
{{< /variant >}}

{{< note title="Ready to get started?" >}}
Ready to get started? Go the [Getting started](../getting-started.md) guide to install Flyte 2 and run your first task.
Ready to get started? Go the [Getting started](../getting-started) guide to install Flyte 2 and run your first task.
{{< /note >}}

## Pure Python execution
Expand All @@ -33,10 +33,10 @@ domain-specific language (DSL).

{{< tabs "flyte-2-python" >}}
{{< tab "Sync Python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/sync.py" lang="python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/sync_example.py" fragment="all" lang="python" >}}
{{< /tab >}}
{{< tab "Async Python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/async.py" lang="python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/async_example.py" fragment="all" lang="python" >}}
{{< /tab >}}
{{< /tabs >}}

Expand Down Expand Up @@ -69,7 +69,7 @@ Tasks are defined within environments, which encapsulate the context and resourc
Flyte tasks support caching via `@env.task(cache=...)`, but tracing with `@flyte.trace` augments task level-caching
even further enabling reproducibility and recovery at the sub-task function level.

{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/trace.py" lang="python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/trace.py" fragment="all" lang="python" >}}

Here the `call_llm` function is called in the same container as `main` that serves as an automated checkpoint with full
observability in the UI. If the task run fails, the workflow is able to recover and replay from where it left off.
Expand All @@ -85,7 +85,7 @@ Flyte 2 provides full management of the workflow lifecycle through a standardize

You can also fetch and run remote (previously deployed) tasks within the course of a running workflow.

{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/remote.py" lang="python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/remote.py" fragment="all" lang="python" >}}

## Native Notebook support

Expand All @@ -101,7 +101,7 @@ Author and run workflows and fetch workflow metadata (I/O and logs) directly fro
Schedule tasks in milliseconds with reusable containers, which massively increases the throughput of containerized tasks.

{{< /markdown >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/reusable.py" lang="python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/task-configuration/reusable-containers/example.py" fragment="first-example" lang="python" >}}
{{< markdown >}}

Coupled with multi-cluster, multi-cloud, and multi-region support, Flyte 2 can scale to handle even the most demanding
Expand Down
8 changes: 4 additions & 4 deletions content/user-guide/flyte-2/async.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Python's asynchronous programming capabilities have evolved significantly:

Consider this pattern for parallel data processing:

{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/async/async.py" lang="python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/async/async.py" fragment="async" lang="python" >}}

In standard Python, this would provide concurrency benefits primarily for I/O-bound operations.
In Flyte 2, the orchestrator schedules each `process_chunk` task on separate Kubernetes pods or configured plugins, achieving true parallelism for any type of work.
Expand All @@ -84,7 +84,7 @@ The Flyte platform handles the complex orchestration while you express paralleli

Recognizing that many existing codebases use synchronous functions, Flyte 2 provides seamless backward compatibility:

{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/async/calling_sync_from_async.py" lang="python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/async/async.py" fragment="calling-sync-from-async" lang="python" >}}

Under the hood, Flyte automatically "asyncifies" synchronous functions, wrapping them to participate seamlessly in the async execution model.
You don't need to rewrite existing code—just leverage the `.aio()` method when calling sync tasks from async contexts.
Expand All @@ -96,10 +96,10 @@ The new `flyte.map` can be used either in synchronous or asynchronous contexts,

{{< tabs "whats-new-map-function" >}}
{{< tab "Sync Map" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/async/sync_map.py" lang="python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/async/async.py" fragment="sync-map" lang="python" >}}
{{< /tab >}}
{{< tab "Async Map" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/async/async_map.py" lang="python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/async/async.py" fragment="async-map" lang="python" >}}
{{< /tab >}}
{{< /tabs >}}

Expand Down
4 changes: 2 additions & 2 deletions content/user-guide/flyte-2/pure-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import flytekit

image = flytekit.ImageSpec(
name="hello-world-image",
packages=[...],
packages=["requests"],
)

@flytekit.task(container_image=image)
Expand All @@ -48,7 +48,7 @@ def main(data: list[float]) -> float:
{{< /markdown >}}
{{< /tab >}}
{{< tab "Flyte 2" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/pure-python/flyte_2.py" lang="python" >}}
{{< code file="/external/unionai-examples/v2/user-guide/flyte-2/pure-python/flyte_2.py" fragment="all" lang="python" >}}
{{< /tab >}}
{{< /tabs >}}

Expand Down