1 unstable release
new 0.0.1 | Nov 26, 2024 |
---|
#28 in #relation
119 downloads per month
125KB
3.5K
SLoC
WillDo
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.
Usage
-
Use it as a crate in your project - see examples and docs to get started. The
Graph
implementsDisplay
with a digraph output which can be rendered with graphviz to visualize the state. You can provide your ownCommander
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.
TODO
- Pass resources between jobs, such as exit codes, outputs, variables.
- Preserve and load job state so we can pick up where we left off.
- An official and stable CLI.
- Later: other configuration sources.
- Later: fancy interactive TUI.
- Maybe: more ways to work with the graph.
Dependencies
~5–16MB
~215K SLoC