toast
toast copied to clipboard
Parallel task execution
Would you be open to a PR implementing parallel task execution?
My use case is developing a web app. The backend and frontend are implemented in different languages with separate live-reloading infrastructure, so it makes sense to keep those in separate containers / dependency chains.
It'd be nice if a single command could run both tasks in parallel (in the example below, toast dev
).
Currently one must open separate terminals and manually run two separate toast tasks.
This makes it harder to hand-off to teammates, since I can't give them a single command to start the dev environment.
One could write a little shell script to spawn two toast invocations, but then responsibilities are muddled ("I thought I was supposed to use toast
to run commands, so why do we have some shell scripts?")
For my case, it'd be fine to interleave the output. Alternatively we could also have an option to prefix each line of the output with the task name.
image: ubuntu:22.04@sha256:0f744430d9643a0ec647a4addcac14b1fbb11424be434165c15e2cc7269f70f8
command_prefix: set -euo pipefail
tasks:
dev:
description: Start the entire development system
dependencies:
- frontend
- backend
frontend:
description: Start the frontend builder / live-reloader
command: |
while true; do
echo 'frontend...'
sleep 1
done
backend:
description: Start the backend server
command: |
while true; do
echo 'server...'
sleep 1
done
Hello, this is an interesting proposal, but it would be a significant change. See the discussion here: https://github.com/stepchowfun/toast/issues/405
I don't think I currently have the bandwidth to commit to reviewing a PR for this, but I welcome any discussion about it. It would be nice to have this someday!
(If you think this could be implemented fairly easily with a small-ish change, let me know—maybe I'm overestimating the work.)
Sure thing, thanks for the pointer to previous discussion. I'll take a look at impl details sometime to gauge complexity and report back.