A crontab visualizer made in Go with Raylib bindings.
Initially made for learning purposes, finished out of love <3 (or masochism).
Imagine a process orchestrator (Airflow, Celery, etc.) that coordinates over 200 processes. Each process has a cron that defines when it will be executed.
Now, think about how you would decide the cron for your new process. This is important so your new cron doesn't collide with heavy processes or workload peaks, which would create overhead that could be better distributed.
It's hard if can't visualize the data, right? That's where cuckoo comes in.
cuckoo lets you visualize crons as coordinates on a grid to:
- Get insights about your crons with just a glance.
- Know the next free spot where you can place a new cron.
- Identify periods where there is a work overload.
To install cuckoo:
go install github.com/kerudev/cuckoo@latestTakes a JSON file with the following structure:
{
"process_1": "*/5 * * * *",
"process_2": "0 */2 * * *",
"process_3": "15 3 * * *",
// ...
}Or a CSV file with two columns (header names are just a convention, but mind the colons!):
name,cron
process_1,"*/5 * * * *"
process_2,"0 */2 * * *"
process_3,"15 3 * * *"
# ...To run cuckoo:
cuckoo # Runs from the current directory
cuckoo -path path/to/data # Runs from a directory / loads and parses a filecuckoo's dependencies:
- raylib-go: Go bindings for raylib & raygui.
dev dependencies:
- air: hot module reloading for Go.
When running go build or go run, you may want to pass the tags argument.
This tells the bindings how to handle windows, and keyboard and mouse events.
Example:
go run -tags x11 . -path ...I usually compile with the noaudio tag to save space, as there are no audio
involved in cuckoo:
go build -tags x11
du -sh cuckoo
7.8M cuckoo
go build -tags noaudio,x11
du -sh cuckoo
6.5M cuckoo- List of tags: https://github.com/gen2brain/raylib-go/blob/master/README.md#build-tags
- Related discussion: gen2brain/raylib-go#554
Although cuckoo is a really small program, I feel like it spends too much time on the CPU, probably due to not being able to compile without cgo.
The debug module has a DebugServer() that I use to measure performance.
I run cuckoo on one shell and this command on other shell:
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=10
flat flat% sum% cum cum%
7.96s 80.24% 80.24% 9.51s 95.87% runtime.cgocall
0.29s 2.92% 83.17% 0.49s 4.94% runtime.casgstatus
0.28s 2.82% 85.99% 0.76s 7.66% runtime.reentersyscallSeems like 95% of the time is spent on the CPU doing cgo stuff.
Right now, cuckoo can't compile with CGO_ENABLED=0 because raygui doesn't
support it, but I plan for that to change.
This project is currently being developed just for desktop. A WASM port is in the works but not ready yet, as the project that ports raylib to WASM doesn't support raygui yet (see BrownNPC/Raylib-Go-Wasm #10).
Caution
These notes are subject to change, as they describe the current way of using the raygui bindings, which are under development on other project.
Complete guide: https://github.com/BrownNPC/Raylib-Go-Wasm/blob/master/README.md
To compile cuckoo to WASM:
- Clone or create a symlink to the WASM bindings repository:
git clone https://github.com/BrownNPC/Raylib-Go-Wasm.git
ln -s path/to/Raylib-Go-Wasm/ Raylib-Go-Wasm # I do this while developing the bindings-
Checkout to the
rayguibranch. -
Paste this into
go.modand rungo mod tidy:
replace (
github.com/gen2brain/raylib-go/raygui => ./Raylib-Go-Wasm/raygui
github.com/gen2brain/raylib-go/raylib => ./Raylib-Go-Wasm/raylib
github.com/BrownNPC/Raylib-Go-Wasm/wasm-runtime => ./Raylib-Go-Wasm/wasm-runtime
)- WASM doesn't support Raylib's
WindowShouldClose(), so you need to change this:
for !rl.WindowShouldClose() { ... }To this:
var update = func() { ... }
rl.SetMainLoop(update)- You might lots of errors in the code, but they are normal. Compile with:
GOOS=js GOARCH=wasm go build -o ./Raylib-Go-Wasm/index/main.wasm .- Run the server of your choice:
- On Python:
cd Raylib-Go-Wasm/index && python -m http.server - On Go:
go build ./Raylib-Go-Wasm/server/server.gothen./server