New to Kestra?
Use blueprints to kickstart your first workflows.
Clone a Git repo and launch a GPU-accelerated Python script on Modal's serverless cloud with Kestra. Declarative YAML, retries, and full run lineage.
id: gpu-modal
namespace: company.team
tasks:
- id: python_repository
type: io.kestra.plugin.core.flow.WorkingDirectory
tasks:
- id: clone_repository
type: io.kestra.plugin.git.Clone
branch: main
url: https://github.com/kestra-io/scripts
- id: modal
type: io.kestra.plugin.modal.cli.ModalCLI
commands:
- modal run modal/gpu.py
docker:
image: ghcr.io/kestra-io/modal:latest
env:
MODAL_TOKEN_ID: "{{ secret('MODAL_TOKEN_ID') }}"
MODAL_TOKEN_SECRET: "{{ secret('MODAL_TOKEN_SECRET') }}"
Run a GPU-accelerated Python script on Modal's serverless cloud without managing any GPU infrastructure yourself. This blueprint clones a Git repository, uses the Modal CLI inside a prebuilt container to launch a Python script, and lets Modal provision the GPU on demand. It solves a common machine learning and data science problem: you need GPU compute for inference, training, or batch jobs, but you do not want to keep an expensive GPU instance running or stitch together shell scripts and cron entries to trigger it.
io.kestra.plugin.core.flow.WorkingDirectory task creates a shared workspace so the cloned code and the Modal CLI run in the same directory.io.kestra.plugin.git.Clone checks out the main branch of https://github.com/kestra-io/scripts, which contains the modal/gpu.py example script.io.kestra.plugin.modal.cli.ModalCLI runs modal run modal/gpu.py from inside the ghcr.io/kestra-io/modal:latest Docker image. Modal then provisions a GPU-enabled server in its cloud, executes the script, and tears the resources down when the run finishes.MODAL_TOKEN_ID and MODAL_TOKEN_SECRET environment variables, both sourced from Kestra secrets.ghcr.io/kestra-io/modal:latest) with the Modal CLI preinstalled.Modal handles the GPU provisioning, but it does not orchestrate the surrounding workflow. Kestra adds event and schedule triggers so a GPU job can fire when upstream data lands or on a cron, automatic retries when a transient cloud error occurs, run lineage across the Git clone and the Modal step, and a single declarative YAML definition that lives in version control alongside the rest of your pipelines. You get one place to see logs, replay failed runs, and chain the GPU step into larger data flows.
ghcr.io/kestra-io/modal:latest image.MODAL_TOKEN_ID: your Modal API token ID.MODAL_TOKEN_SECRET: your Modal API token secret.MODAL_TOKEN_ID and MODAL_TOKEN_SECRET as Kestra secrets.io.kestra.plugin.git.Clone at your own repository and swap modal run modal/gpu.py for your script.Schedule or flow trigger to run the GPU job automatically.