Workflow Registration and Execution Flow
This sequence diagram illustrates the dual flows of Workflow Registration and Workflow Execution within the Flyte SDK.
Registration Flow
The registration flow begins when a user calls flyte.deploy(). The SDK packages the environment and its tasks into a DeploymentPlan. Each task, represented by a TaskTemplate, is translated into a wire-format TaskSpec. The ClientSet (acting as the Remote Orchestration & Management) then communicates with the remote Flyte Admin service via the TaskService to register the task definition.
Execution Flow
The execution flow is triggered by flyte.run(). The _Runner component manages the lifecycle of the remote execution:
- Image & Code Bundling: It ensures that the necessary container images are built and the source code is bundled (either as a
.tgzor.pklfile). - Type Validation: The
TypeEngineis invoked to validate the user's native Python arguments against the task'sNativeInterface. It transforms these arguments into Flyte Core Type System Architecture. - Input Upload: Before triggering the run, the SDK uploads the transformed inputs to the Flyte backend using the
DataProxyService. - Execution Trigger: Finally, the
ClientSetcallsRunService.create_run()to initiate the execution on the Flyte cluster. The call returns aRunobject (representing the Core Execution Framework), which the user can use to track status, logs, and outputs.
Key architectural components discovered include the ClientSet for unified API access, the TypeEngine for extensible type transformations, and the TaskTemplate as the primary unit of definition for both tasks and workflows in this SDK version.
Key Architectural Findings:
- The SDK uses a
ClientSetclass as a unified entry point for all Flyte Admin services (Task, Run, DataProxy, etc.). TaskTemplateserves as the core definition entity, encompassing what was traditionally split between tasks and workflows.- The
TypeEnginehandles the complex mapping between native Python types and Flyte's protobuf-basedLiteralsystem. - Remote execution involves a multi-step process: image building, code bundling, input transformation, input uploading via
DataProxy, and finally run creation. - The
Runclass acts as the handle for an active or completed execution, providing methods to wait for completion, fetch logs, and retrieve outputs.