Crates.io | willdo |
lib.rs | willdo |
version | 0.0.1 |
source | src |
created_at | 2024-11-26 18:01:49.011447 |
updated_at | 2024-11-26 18:01:49.011447 |
description | Task manager with DAG |
homepage | |
repository | https://gitlab.com/BrightOpen/willdo |
max_upload_size | |
id | 1462101 |
size | 197,873 |
Will do some work when the conditions are ripe!
It is a generic task manager for running jobs with a directed acyclic graph (DAG) dependency resolution. Configuration is loaded from simple yaml files:
job: baking
script:
- echo oven 250
- echo insert yummy
- sleep 3600
- echo oven off
- echo take yummy
---
job: oops
when:
- done: baking
code:
min: 1 # that is non-zero, baking failed
script: echo alarm!
---
job: cleanup
when:
- any:
- done: baking # assuming 0 - success
- done: oops
script: echo tidy up
Jobs are effectively scheduled when their parent dependencies
(when
) are satisfied. Dependencies can be conditional
with a simple code arithmetic conditions and combined
into complex rules (all/any). By default, all
dependencies must be satisfied.
Triggers (then
) are opposite - child - relations.
The crate includes a subprocess commander behind a feature of same name,
so any shell or repl can be utilized immediately to run your scripts.
The default commander is ()
which does nothing.
You can configure an interpretter:
interpretter: sh
provider: subprocess
executable: dash
---
job: making
runs: sh
script:
- test -f .skip && echo skipped || echo make
In order to discern the outcome of a script command, the commander must provide feedback to send back the numeric code of the last operation. This is not easily done in a subprocess and is achieved by printing a uniquely stamped string that is parsed from child process outputs.
Use it as a crate in your project - see examples and docs to get started.
The Graph
implements Display
with a digraph output which can be rendered with graphviz
to visualize the state. You can provide your own Commander
to interpret job scripts.
Build the examples that can run jobs as a CLI, you could install the examples with cargo, but I would not recommend it at this stage as the interfaces are not stable.