Karmchari is a general purpose job manager written in Go. It allows for adding a job and updating and reading job states through a REST API.
Having Karmchari maintain a global state of running processes can help give better control on the jobs running on various sytems and workers.
- Asynchronously signal workers to pause or kill jobs.
- Keep track of long running jobs.
Karmchari uses Redis for data storage. A quick way to run Redis is using its Docker image.
docker run -p 6379:6379 --name redis-karmchari -d redis
Perhaps the simplest way to run Karmchari is through the included Dockerfile
, and linking to the redis container.
docker build -t karmchari .
docker run -p 51463:51463 --name karmchari-prod --link redis-karmchari:redis -d karmchari
on Linux based PCs, simply run
./docker-build.sh
port : port to start the app on ex. 51463
shost : host for the redis instance ex. localhost:6379
Currently two endpoints are supported - registerJob
and jobState
.
Add a new job.
type : type of job - can be upload, export or teams
On success the job ID - MD5 hash string.
On failure appropriate error codes.
Change the state of a job.
id : job id
command : what to do with the job - can be start, pause or kill
On success the job ID and new state.
On failure appropriate error codes.
Read the state of a job
id : job id
On success returns the job state (start, pause or kill)
On failure appropriate error codes.
Karmchari's APIs can be accessed through an HTTP client such as curl
or wget
.
curl -d "type=teams" http://localhost:51463/registerJob
Output: Created! id = 45c02fc01519814156e94adbd1902279
curl -d "id=45c02fc01519814156e94adbd1902279&command=pause" http://localhost:51463/jobState
Output: 45c02fc01519814156e94adbd1902279 -- pause
curl http://localhost:51463/jobState?id=45c02fc01519814156e94adbd1902279
Output: 45c02fc01519814156e94adbd1902279 -- pause