Workflow Execution and Registration Flow
This diagram illustrates the sequence of events for both registering a new workflow and executing it using the Flytekit SDK and CLI.
Registration Flow:
- A developer uses the
flyte deploycommand to register their workflow code. - The CLI invokes the
flyte.deployfunction within the Flytekit SDK. - The SDK then plans the deployment, which involves analyzing the tasks and their dependencies.
- The
applyfunction orchestrates the deployment, calling_deploy_task_envand then_deploy_taskfor each individual task within the environment. - Finally, a
DeployTaskRequestis sent to the Flyte Backend API to create or update the task registration.
Execution Flow:
- A user or developer initiates a remote execution using the
flyte run --remotecommand, specifying the task and its inputs. - The CLI uses the
with_runcontextandrunmethods in the SDK to prepare the execution. - The internal
_Runnerclass's_run_remotemethod is called. - The SDK first sends an
UploadInputsRequestto the Flyte backend's dataproxy service to offload any large input data. - With the inputs uploaded, the SDK sends a
CreateRunRequestto the backend's run service to launch the workflow. - The backend returns a
CreateRunResponse, and the SDK provides aRunobject back to the CLI, which then displays the execution URL and status to the user.
Key Architectural Findings:
- The
flyte deploycommand initiates the registration process, which involves a series of internal SDK calls culminating in aDeployTaskRequestto the backend. - The core registration logic is found in
flyte._deploy.py, with_deploy_taskbeing the function that makes the final API call. - The
flyte run --remotecommand triggers the execution flow. - Execution involves a
_Runnerclass withinflyte._run.pythat handles the remote execution. - Remote execution is a two-step process: first uploading inputs via
dataproxy_service.upload_inputsand then creating the run viarun_service.create_run.
Loading diagram...