Local task execution
Execute your tasks locally before deploying to Airplane.
The Airplane CLI can be used to test your tasks locally before deploying to Airplane. If you haven't installed the CLI, do that before continuing.
To execute your task locally:
bashCopied1$ airplane dev path/to/definition.task.yaml
bashCopied1$ airplane dev path/to/file
If your task has any parameters, you'll be prompted:
bashCopied1$ airplane dev my_task.task.yaml2? Dry Run (--dry_run): [Use arrows to move, type to filter]3> Yes4No
bashCopied1$ airplane dev ./main.js2? Dry Run (--dry_run): [Use arrows to move, type to filter]3> Yes4No
These inputs can also be passed as CLI args:
bashCopied1$ airplane dev my_task.task.yaml -- --help23Test Task Usage:4--dry_run (default: true)56$ airplane dev my_task.task.yaml -- --dry_run=false
bashCopied1$ airplane dev ./main.js -- --help23Test Task Usage:4--dry_run (default: true)56$ airplane dev ./main.js -- --dry_run=false
Environment Variables
The airplane dev
command will load any environment variables declared in a .env
or
airplane.env
when executing your task.
For example, if you had two tasks (task_a
and task_b
) with the following directory layout:
Copied1tasks/2├── airplane.env3├── package.json4├── task_a.js5└── task_b/6├── airplane.env7└── task_b.js89# tasks/airplane.env10DB_URL=postgres://shareddb1112# tasks/task_b/airplane.env13STRIPE_API_KEY=abcd14DB_URL=postgres://stripedb
When task A is run, it will have access to the shareddb
DB URL in its environment. For task B, it
will have access to the a STRIPE_API_KEY
and the stripedb
DB URL.