Blueprints

GPU-accelerated Python script with Modal

Source

yaml
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') }}"

About this blueprint

CLI Python

This flow clones a repository, pulls a public container image with the required dependencies and runs a Python script in a Docker container.

The Python script uses Modal Python Client to run the script on a GPU-enabled server.

  • To learn more about GPU support on modal.com, check the Modal documentation
  • The Python script is available in the repository: kestra-io/scripts This flow assumes that you have a Modal account and that you stored the Modal credentials as secrets.

Working Directory

Clone

Modal CLI

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra