Skip to content

Parallel task execution #446

@lynaghk

Description

@lynaghk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions