Install
pito-jobs is a Rust library, pulled from GitHub by its tag. It needs Rust 1.91 or newer.
Linux, macOS and WSL
Section titled “Linux, macOS and WSL”The same line on all three:
cargo add pito-jobs --git https://github.com/gmrdad82/pito-jobs --tag v1.0.2or in your Cargo.toml:
pito-jobs = { git = "https://github.com/gmrdad82/pito-jobs", tag = "v1.0.2" }It works on Linux and macOS, and on Windows through WSL; CI tests it on Linux and macOS.
Native Windows and wasm
Section titled “Native Windows and wasm”The crate also builds for native Windows and for wasm32. On wasm every
handle is inert, so a cross-platform app can link it unconditionally and
call it everywhere. Native Windows builds, but CI does not run its tests
there.
Quick start
Section titled “Quick start”In the tool:
let job = pito_jobs::start("encode", None, "talk.mp4 → web.mp4");job.stage("encode", Some(240), "frames");for frame in 1..=240 { job.progress(frame);}job.finish(0);While it runs, the job folder holds one JSON file for it, named
<pid>-<started>.json. The folder is $PITO_JOBS_DIR when set, else
$XDG_RUNTIME_DIR/pito-jobs on Linux, else $TMPDIR/pito-jobs on macOS.
Any program can read the records back with pito_jobs::read_dir; see
Read jobs back.
To watch three jobs write while a reader draws them, as in the clip on the overview:
git clone https://github.com/gmrdad82/pito-jobs && cd pito-jobscargo run --release --example demoThe other examples are heartbeat, lines and bench, each run the same
way.