runabol / tork

A distributed workflow engine
https://tork.run
MIT License
577 stars 36 forks source link

Feature: Job progress #427

Closed runabol closed 3 months ago

runabol commented 3 months ago

This PR adds support for task-level and job-level progress.

  1. To report the task progress, write a value between 0-100 to the path specified in $TORK_PROGRESS.
  2. A job's progress automatically updates whenever a task reports its progress and when the task completes.
  3. To subscribe for task-level progress events use the task.Progress webhook event.
  4. To subscribe for task-level progress events use the job.Progress webhook event.

Example:

name: my job
tasks:
  - name: my task
    run: |
      for i in $(seq 1 100)
      do
        echo $i
        echo $i > $TORK_PROGRESS
        sleep 0.1
      done
    image: alpine:3.18.3
webhooks:
  - url: https://example.com/my/callback
    event: job.Progress