1.3.0 • Published 10 years ago
workaholic v1.3.0
Workaholic
Workaholic is distributed execFile
worker using Redis for work(task) assign, written with javascript(node.js)
Architecture
Redis : use for task queueing, ticket storing
boss/boss.js
: fork and control workers forever- `worker/worker.js` : workers, get tasks from Redis
front/front.js
: front-desk, registers task to Redis
Installation
git clone https://github.com/flrngel/workaholic
cd workaholic
npm install
worklist.json
worklist.json is for use to execute file(execFile)
It is highly recommended not to use interpreter applications for security reasons, execute as your own signle script.
{
"<task name>": {
"execFile" : "<File to execute>",
"options": {
// see available options from http://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback
}
}
}
config.json
config.json is for use to control Workaholic(boss
, worker
, front
)
{
// redis configuration
"redis":{
"host": "localhost",
"port": 6379,
// ticket time to live - work ticket(key in redis) expire time(redis expire). -1 to permanent
"ticket_ttl": 60,
// authentication using redis auth command, removable
"password": "<insert_your_redis_auth_password>"
},
// front-desk configuration
"front":{
// listening port
"port": 8007,
// authentication for front-desk, removable
"password": "<insert_your_password>"
},
// worker configuration
"worker":{
// number of workers
"number": 4,
// wait time
"sleeptime": 100
}
}
front/front.js (response type: json)
GET /info
Get Workaholic package information
POST /work/new
request
{
"ticketing(optional;boolean type)": true,
"data": {
"taskName(string type)": "<task anme>",
"argument(array type, strings)": ["<arg1>","<arg2>..."]
}
}
response
{
"result": (true|false),
"ticket(optional)": <ticket uuid>
}
GET /work/status
request
/work/status?ticket=<ticket uuid>
response
queue
: task is in queue poolassigned
: worker assigned taskend
: task was successfully endederror
: task had error
Roadmap (todo list)
architecture security improvement(status: unstable)- front-desk access list
- benchmark test
- worker status
- thin worker
- task tracking
- boss controller
workers with different tasklist