cmdstalk
Cmdstalk is a unix-process-based beanstalkd queue broker.
Written in Go, cmdstalk uses the kr/beanstalk
library to interact with the beanstalkd queue daemon.
Each job is passed as stdin to a new instance of the configured worker command.
On exit(0)
the job is deleted. On exit(1)
(or any non-zero status) the job
is released with an exponential-backoff delay (releases^4), up to 10 times.
If the worker has not finished by the time the job TTR is reached, the worker
is killed (SIGTERM, SIGKILL) and the job is allowed to time out. When the
job is subsequently reserved, the timeouts: 1
will cause it to be buried.
In this way, job workers can be arbitrary commands, and queue semantics are
reduced down to basic unix concepts of exit status and signals.
Install
From source:
go install github.com/99designs/cmdstalk@latest
From binary:
https://github.com/99designs/cmdstalk/releases
Usage
cmdstalk -help
cmdstalk -cmd="/path/to/your/worker --your=flags --here" -tubes="one,two,three"
cmdstalk -all -cmd="cat" -per-tube=4
Dev
go test ./...
(cd broker && go test -v)
go run cmdstalk.go -cmd='hexdump -C' -tubes="default,another"
go build
file cmdstalk
Release
go install github.com/mitchellh/gox@latest
gox -build-toolchain -os="darwin linux" -arch="amd64"
gox -os="darwin linux" -arch="amd64"
gzip cmdstalk_*_*
open https://github.com/99designs/cmdstalk/releases/new
TODO
- Graceful shutdown.
- SIGKILL recalcitrant worker processes.
- Logging improvements; stdout/stderr, concurrency-safety.
- Interactive mode; single-concurrency, prompt for action for each job.
Created by Paul Annesley and Lachlan Donald.
© Copyright 2014 99designs Inc.