2 releases
0.0.5 | May 15, 2024 |
---|---|
0.0.3 | May 4, 2023 |
#578 in Asynchronous
95 downloads per month
185KB
3.5K
SLoC
taski
TODO
-
allow users to specify custom colors
-
support dynamic arguments too
-
add examples of competitor libs
-
add embedme
-
add documentation
-
add one more example
-
improve the layout library using plotters
-
NO: add a builder for the scheduler
-
NO: add a schedule trait
-
DONE: add more tests for different policies: fifo, priority, custom
-
DONE: use logging
-
DONE: remove the trace mutex? should not be required
-
DONE: add support for async closures / functions
-
DONE: use petgraph for the graph representation
Design decisions
- task node is internal, because this is where the state is kept (interior mutability) and where the unique index is assigned to
- construction from the user not possible
- only possible to creatge using
add_task
- only valid input as dependency (we know it was added (otherwise we do)) and we know it cannot have circles
- user cannot run any methods on it? wrong because of task trait
- use a result type, to allow for fail fast strategies
- user workaround: use infallible and propagate an Option
- clone outputs as inputs, this is more efficient for small data such as i32
- for large data (or data that cannot be cloned), just return an Arc
Development
cargo install cargo-expand
cargo expand ::task
There exist many different task scheduler implementations, the goals of this implementation are as follows:
- support async tasks
- support directed acyclic graphs with cycle detection
- allow custom scheduling policies based on a custom ID type, which could enforce complex constraints by using labels
- allow concurrent adding of tasks while the scheduler is executing, so that tasks can be streamed into the scheduler
Dependencies
~2.8–6.5MB
~112K SLoC