l.c.c.d.CodeImportDispatcher : class documentation

Part of lp.codehosting.codeimport.dispatcher View In Hierarchy

A CodeImportDispatcher kicks off the processing of a job if needed.

The entry point is findAndDispatchJob.

Instance VariablestxnA transaction manager.
loggerA 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.
def __init__(self, logger, worker_limit, _sleep=time.sleep):
Initialize an instance.
ParametersloggerA Logger object.
def getHostname(self):
Return the hostname of this machine.

This usually calls socket.gethostname but it can be overridden by the config for tests and developer machines.

def dispatchJob(self, job_id):
Start the processing of job job_id.
def findAndDispatchJob(self, scheduler_client):
Check for and dispatch a job if necessary.
ReturnsA boolean, true if a job was found and dispatched.
def _getSleepInterval(self):
How long to sleep for until asking for a new job.

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.

def findAndDispatchJobs(self, scheduler_client):
Call findAndDispatchJob until no job is found.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.