kvark / choir

Task Orchestration Framework
MIT License
52 stars 3 forks source link

Proxy tasks #15

Closed kvark closed 2 years ago

kvark commented 2 years ago

This is a major API breaking change, hopefully an improvement :) Task creation is now done in 3 steps (instead of 2):

  1. ProtoTask is created. It has the context information and an ID or a name
  2. Function is assigned, and the task becomes an IdleTask
  3. Dependencies are added, and the task can be ran, becoming RunningTask

In addition, all the task functions now receive an extra argument - &Arc<Notifier>. This is essentially a task context. Main motivation for this change was to allow tasks to spawn child tasks from within the executing body. This is now possible: a task can spawn a proxy task using the notifier given as the argument. The proxy can have its own dependencies, since the caller decides when to run it.