Execute tasks defined in application templates.
For most users, running tasks is straightforward:
# List available tasks
dr run --list
# Run a task (e.g., start development server)
dr run devThe command automatically discovers tasks from your template's Taskfiles and executes them with your environment configuration.
Note
First time? If you're new to the CLI, start with the Quick start for step-by-step setup instructions.
dr run [TASK_NAME...] [flags]The dr run command executes tasks defined in Taskfiles within DataRobot application templates. It automatically discovers component Taskfiles and aggregates them into a unified task execution environment.
The command provides a convenient way to execute common application tasks such as starting development servers, running tests, building containers, and deploying applications. It works by discovering Taskfiles in your template directory and generating a consolidated task runner configuration.
Key features:
- Automatic discovery—finds and aggregates Taskfiles from template components.
- Template validation—verifies you're in a DataRobot template directory.
- Conflict detection—prevents dotenv directive conflicts in nested Taskfiles.
- Parallel execution—run multiple tasks simultaneously.
- Watch mode—automatically re-run tasks when files change.
To use dr run, your directory must meet these requirements:
- Contains a .env file—indicates you're in a DataRobot template directory.
- Contains Taskfiles—component directories with
Taskfile.yamlorTaskfile.ymlfiles. - No dotenv conflicts—component Taskfiles cannot have their own
dotenvdirectives.
If these requirements aren't met, the command provides clear error messages explaining the issue.
-l, --list List all available tasks
-d, --dir string Directory to look for tasks (default ".")
-p, --parallel Run tasks in parallel
-C, --concurrency int Number of concurrent tasks to run (default 2)
-w, --watch Enable watch mode for the given task
-y, --yes Assume "yes" as answer to all prompts
-x, --exit-code Pass-through the exit code of the task command
-s, --silent Disable echoing
-h, --help Help for run -v, --verbose Enable verbose output
--debug Enable debug outputdr run --listOutput:
Available tasks:
* dev Start development server
* test Run tests
* lint Run linters
* build Build Docker container
* deploy Deploy to DataRobot
dr run devStarts the development server defined in your template's Taskfile.
dr run lint testRuns the lint task, then the test task in sequence.
dr run lint test --parallelRuns lint and test tasks simultaneously.
dr run dev --watchRuns the development server and automatically restarts it when source files change.
dr run task1 task2 task3 --parallel --concurrency 3Runs up to 3 tasks concurrently.
dr run build --silentRuns the build task without echoing commands.
dr run test --exit-codeExits with the same code as the task command (useful in CI/CD).
The dr run command discovers tasks in this order:
- Check for .env file—verifies you're in a template directory.
- Scan for Taskfiles—finds
Taskfile.yamlorTaskfile.ymlfiles up to 2 levels deep. - Validate dotenv directives—ensures component Taskfiles don't have conflicting
dotenvdeclarations. - Generate Taskfile.gen.yaml—creates a unified task configuration.
- Execute tasks—runs the requested tasks using the
taskbinary.
my-template/
├── .env # Required: template marker
├── Taskfile.gen.yaml # Generated: consolidated tasks
├── backend/
│ ├── Taskfile.yaml # Component tasks (no dotenv)
│ └── src/
└── frontend/
├── Taskfile.yaml # Component tasks (no dotenv)
└── src/
The CLI generates Taskfile.gen.yaml with this structure:
version: '3'
dotenv: [".env"]
includes:
backend:
taskfile: ./backend/Taskfile.yaml
dir: ./backend
frontend:
taskfile: ./frontend/Taskfile.yaml
dir: ./frontendThis allows you to run component tasks with prefixes:
dr run backend:build
dr run frontend:devIf you run dr run outside a DataRobot template:
You don't seem to be in a DataRobot Template directory.
This command requires a .env file to be present.
Solution: Navigate to a template directory or run dr templates setup to create one.
If a component Taskfile has its own dotenv directive:
Error: Cannot generate Taskfile because an existing Taskfile already has a dotenv directive.
existing Taskfile already has dotenv directive: backend/Taskfile.yaml
Solution: Remove the dotenv directive from component Taskfiles. The generated Taskfile.gen.yaml handles environment variables.
If the task binary isn't installed:
"task" binary not found in PATH. Please install Task from https://taskfile.dev/installation/
Solution: Install Task following the instructions at taskfile.dev/installation.
If no Taskfiles exist in component directories:
file does not exist
Error: failed to list tasks: exit status 1
Solution: Add Taskfiles to your template components or use dr templates setup to start with a pre-configured template.
Tasks are defined in component Taskfile.yaml files using Task's syntax.
version: '3'
tasks:
dev:
desc: Start development server
cmds:
- python -m uvicorn src.app.main:app --reloadtasks:
build:
desc: Build Docker container
cmds:
- docker build -t {{.APP_NAME}} .
deploy:
desc: Deploy application
deps: [build]
cmds:
- docker push {{.APP_NAME}}
- kubectl apply -f deploy.yamltasks:
test:
desc: Run tests with coverage
env:
PYTEST_ARGS: "--cov=src --cov-report=html"
cmds:
- pytest {{.PYTEST_ARGS}}tasks:
deploy:
desc: Deploy to production
preconditions:
- sh: test -f .env
msg: ".env file is required"
- sh: test -n "$DATAROBOT_ENDPOINT"
msg: "DATAROBOT_ENDPOINT must be set"
cmds:
- ./deploy.shUse clear, action-oriented task names:
tasks:
dev: # ✅ Clear and concise
desc: Start development server
test:unit: # ✅ Namespaced for organization
desc: Run unit tests
lint:python: # ✅ Specific and descriptive
desc: Run Python lintersProvide helpful task descriptions:
tasks:
deploy:
desc: Deploy application to DataRobot (requires authentication)
cmds:
- ./deploy.shUse standard names for common operations:
dev—start development server.build—build application or container.test—run test suite.lint—run linters and formatters.deploy—deploy to target environment.clean—clean build artifacts.
Reference .env variables in tasks:
tasks:
deploy:
desc: Deploy {{.APP_NAME}} to {{.DEPLOYMENT_TARGET}}
cmds:
- echo "Deploying to $DATAROBOT_ENDPOINT"
- ./deploy.shUse silent: true for tasks that don't need output:
tasks:
check:version:
desc: Check CLI version
silent: true
cmds:
- dr version# Set up template (clones and configures)
dr templates setup
cd my-app
# Configure environment
dr dotenv setup
# Run tasks
dr run dev# Update environment variables
dr dotenv setup
# Run with updated configuration
dr run deploy#!/bin/bash
# ci-pipeline.sh
set -e
# Run tests
dr run test --exit-code --silent
# Run linters
dr run lint --exit-code --silent
# Build
dr run build --silentProblem: dr run --list shows no tasks.
Causes:
- No Taskfiles in component directories.
- Taskfiles at wrong depth (deeper than 2 levels).
Solution:
# Check for Taskfiles
find . -name "Taskfile.y*ml" -maxdepth 3
# Ensure Taskfiles are in component directories
# Correct: ./backend/Taskfile.yaml
# Wrong: ./backend/src/Taskfile.yamlProblem: Tasks can't access environment variables.
Causes:
- Missing
.envfile. - Variables not exported.
Solution:
# Verify .env exists
ls -la .env
# Check variables are set
source .env
env | grep DATAROBOTProblem: Task runs but fails with errors.
Solution:
# Enable verbose output
dr run task-name --verbose
# Enable debug output
dr run task-name --debug
# Check task definition
cat component/Taskfile.yamlProblem: Tasks fail with permission errors.
Solution:
# Make scripts executable
chmod +x scripts/*.sh
# Check file permissions
ls -l scripts/- Template system overview—understanding templates.
- Task definitions—creating Taskfiles.
- Environment variables—managing configuration.
- dr dotenv—environment variable management.
- Task documentation—official Task runner docs.