Part of lp.codehosting.codeimport.dispatcher View In Hierarchy
The entry point is
|Instance Variables||txn||A transaction manager.|
|Method||__init__||Initialize an instance.|
|Method||getHostname||Return the hostname of this machine.|
|Method||dispatchJob||Start the processing of job
|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.|
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.