Part of lp.codehosting.codeimport.dispatcher View In Hierarchy
The entry point is findAndDispatchJob.
| Instance Variables | txn | A transaction manager. |
| logger | A Logger object. |
| Method | __init__ | Initialize an instance. |
| Method | getHostname | Return the hostname of this machine. |
| Method | dispatchJob | Start the processing of job job_id. |
| Method | findAndDispatchJob | Check for and dispatch a job if necessary. |
| Method | findAndDispatchJobs | Call findAndDispatchJob until no job is found. |
| Method | _getSleepInterval | How long to sleep for until asking for a new job. |
| Parameters | logger | A Logger object. |
This usually calls socket.gethostname but it can be
overridden by the config for tests and developer machines.
| Returns | A boolean, true if a job was found and dispatched. | |
The basic idea is to wait longer if the machine is more heavily loaded, so that less loaded slaves get a chance to grab some jobs.
We assume worker_limit will be roughly the number of CPUs in the machine, so load/worker_limit is roughly how loaded the machine is.