procedure of a job
- Client submits job to dispatcher.
- The dispatcher returns the id of the job.
- Client asks dispatcher for a worker
- The dispatcher returns the id of a worker. The thread would be blocked in dispatcher until a worker is found.
- Client spawns a thread to send the request to the worker. If there is any remaining tasks, the main thread goes to 3; otherwise, it goes to 6.
- Client tells the dispatcher that the job is done.
procedure of a worker
- Tell the status checker that it's idle
- Wait for a task to do.
- Go to 1 when task done.
rescheduling
- when a job is done: assign the workers to other jobs if necessary
- when a job is submitted: find idle workers for the job; if none, get some workers from other job (after their current task is done).
Configuration
By defauilt, it takes config/config.rb as configuration file.
I made it a soft link so that you can easily switch between configurations.
config-localhost.rb is an example of configuring homogeneous environment
config-localhost-hetero.rb for heterogeneous environment