Sisyphus Tasks
Utilities for long-running, resilient tasks.
This library contains code I wrote, found useful, and want to keep using. It aims to provide systems
The general idiom is focused on spawning long-lived worker loops, which use channels to communicate.
Understanding this crate
High Level Example
let task = new.run_forever;
Current Utils:
-
Sisyphus
- A scaffolding system for spawning long-lived, recoverable tasks
- A
Boulderis a looping, fallible task Boulderlogic is defined in aBoulder::spawn()method that returns aJoinHandle- A
Fallis an error in that task.Fall::Recoverable- errors that the task believes it can recoverFall::Unrecoverable- errors that the task believes it cannot recover
- The
Boulder::run_until_panicmethod handles restarting on recoverableFalls, and reporting unrecoverable errors Boulders may define custom recovery or cleanup logicBoulders may also panic. In that case, noFallis generated, and the- panic is propagated upward
Sisyphusmanages aBoulderloop. He exposes an interface to observe its status and abort the work
-
Pipe
- An inbound and an outbound channel
- Enforce process-once semantics
- Prevents data loss on worker error
- Designed for relatively linear data-processing pipelines
- e.g. retrieval -> metrics -> indexing -> other handling
- Convenience methods for running synchronous and asynchronous
for_eachon channel contents
Future Utils:
- Abstraction layers for instantiating complex pipes from lists of Sisyphuses
- Pipes should allow sync & async transforms (inbound
T, outboundU)
Copyright Note
Some code descends from utilities written for Nomad. It is used and reproduced under its license terms.