l.c.c.w.CodeImportWorkerMonitor : class documentation

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

Known subclasses: lp.codehosting.codeimport.tests.test_workermonitor.CIWorkerMonitorForTesting, lp.codehosting.codeimport.tests.test_workermonitor.TestWorkerMonitorRunNoProcess.WorkerMonitor, lp.codehosting.codeimport.tests.test_workermonitor.TestWorkerMonitorUnit.WorkerMonitor

Controller for a single import job.

An instance of CodeImportWorkerMonitor runs a child process to perform an import and communicates status to the database.

Method __init__ Construct an instance.
Method getWorkerArguments Get arguments for the worker for the import we are working on.
Method updateHeartbeat Call the updateHeartbeat method for the job we are working on.
Method finishJob Call the finishJobID method for the job we are working on.
Method run Perform the import.
Method callFinishJob Call finishJob() with the appropriate status.
Method _logOopsFromFailure Undocumented
Method _trap_nosuchcodeimportjob Undocumented
Method _createLibrarianFileAlias Call IFileUploadClient.remoteAddFile with the given parameters.
Method _makeProcessProtocol Make an CodeImportWorkerMonitorProtocol for a subprocess.
Method _launchProcess Launch the code-import-worker.py child process.
Method _silenceQuietExit Quietly swallow a ExitQuietly failure.
Method _reasonToStatus Translate the 'reason' for process exit into a result status.
def __init__(self, job_id, logger, codeimport_endpoint, access_policy):
Construct an instance.
Parametersjob_idThe ID of the CodeImportJob we are to work on.
loggerA Logger object.
def _logOopsFromFailure(self, failure):
Undocumented
def _trap_nosuchcodeimportjob(self, failure):
Undocumented
def getWorkerArguments(self):
Get arguments for the worker for the import we are working on.

This also sets the _target_url and _log_file_name attributes for use in the _logOopsFromFailure and finishJob methods respectively.

def updateHeartbeat(self, tail):
Call the updateHeartbeat method for the job we are working on.
def _createLibrarianFileAlias(self, name, size, file, contentType):
Call IFileUploadClient.remoteAddFile with the given parameters.

This is a separate method that exists only to be patched in tests.

def finishJob(self, status):
Call the finishJobID method for the job we are working on.

This method uploads the log file to the librarian first.

def _makeProcessProtocol(self, deferred):
Make an CodeImportWorkerMonitorProtocol for a subprocess.
def _launchProcess(self, worker_arguments):
Launch the code-import-worker.py child process.
def run(self):
Perform the import.
def _silenceQuietExit(self, failure):
Quietly swallow a ExitQuietly failure.
def _reasonToStatus(self, reason):
Translate the 'reason' for process exit into a result status.

Different exit codes are presumed by Twisted to be errors, but are different kinds of success for us.

def callFinishJob(self, reason):
Call finishJob() with the appropriate status.
API Documentation for Launchpad, generated by pydoctor at 2018-02-23 00:00:09.