Jobs

How to Run Jobs

There are many ways to run one-off jobs and tasks. You can run them in the container your app is running or you can spin up a new container that runs the command and then destroys itself.

To run a command in your app container, run:

gigalixir ps:run $COMMAND
# if you're using mix, you'll probably want $COMMAND to be something like `mix ecto.migrate`

To run a command in a separate container, run:

gigalixir run $COMMAND
# if you're using mix, you'll probably want $COMMAND to be something like `mix ecto.migrate`

The task is not run on the same node as your app running node. Jobs are killed after five minutes.

Note
When you run gigalixir run, a new container must be provisioned. You may see “Attempting to run in a new container” for up to a minute while it starts. This is normal behavior, not a hang.

The size of the container that runs your job will be the same size as the app containers and billed the same way, based on replica-size-seconds. (For more on billing, see Pricing Details).

What’s Next?