New to Kestra?
Use blueprints to kickstart your first workflows.
Run a parametrized Python script in parallel across isolated Docker containers with Kestra. Fan out parameter sweeps and batch jobs in one declarative flow.
Run a single parametrized Python script across many parameter values at once, each execution isolated in its own Docker container. This blueprint shows how to fan out a CPU bound or IO bound Python workload (parameter sweeps, batch processing, per item scoring) so that nine values run concurrently instead of one after another, cutting total runtime without writing any multiprocessing or queue code yourself.
io.kestra.plugin.core.flow.ForEach task iterates over the values list (1 through 9) with concurrencyLimit: 0, meaning every value is dispatched in parallel with no cap.io.kestra.plugin.scripts.python.Commands task runs the Python script. The script parametrized.py is supplied inline through the inputFiles property.argparse to read a --num argument, doubles it, and prints the result.{{ taskrun.value }} Pebble expression: python parametrized.py --num {{ taskrun.value }}.io.kestra.plugin.scripts.runner.docker.Docker task runner, so every parallel run executes in a clean, isolated container.A bare Python script or a for loop runs items sequentially and gives you no retries, no isolation, and no visibility. Kestra turns the same logic into a declarative YAML flow: ForEach parallelizes the work, the Docker task runner isolates each run, and you get per task retries, logs, and lineage out of the box. You can add event triggers, schedules, and downstream tasks that the Python interpreter alone cannot provide.
Docker task runner can pull and run containers.This blueprint references no secrets. Add secrets only if you extend the script to call external services.
python task run to inspect its printed result.parametrized.py with a Namespace File by enabling namespaceFiles instead of inputFiles.values list for dynamic inputs or an output from an upstream task.concurrencyLimit to cap how many containers run at once.