l.c.i.c.ICodeImportJobWorkflow(Interface) : interface documentation

Part of lp.code.interfaces.codeimportjob View In Hierarchy

Utility to manage CodeImportJob objects through their life cycle.
Method newJob Create a CodeImportJob associated with a reviewed CodeImport.
Method deletePendingJob Delete a pending CodeImportJob associated with a CodeImport.
Method requestJob Request that a job be run as soon as possible.
Method updateHeartbeat Updates the heartbeat of a running CodeImportJob.
Method startJob Record that machine is about to start work on import_job.
Method finishJob Record that a job finished running.
Method reclaimJob Record that import_job has been reclaimed.
def newJob(code_import, interval=None):
Create a CodeImportJob associated with a reviewed CodeImport.

Call this method from CodeImport.updateFromData when the review_status of code_import changes to REVIEWED.

Parameterscode_importCodeImport object.
intervalSchedule the job this far ahead of the start of the last update of this import. Defaults to code_import.effective_update_interval. This parameter is ignored and the job scheduled for right now if this is the first run of the import.
ReturnsA new CodeImportJob object associated to code_import.
Unknown Field: preconditioncode_import has REVIEWED review_status.
code_import has no associated CodeImportJob.
def deletePendingJob(code_import):
Delete a pending CodeImportJob associated with a CodeImport.

Call this method from CodeImport.updateFromData when the review_status of code_import changes from REVIEWED.

Parameterscode_importCodeImport object.
Unknown Field: preconditioncode_import.review_status != REVIEWED.
code_import is associated to a CodeImportJob.
code_import.import_job.state == PENDING.
Unknown Field: postconditioncode_import.import_job is None.
def requestJob(import_job, user):
Request that a job be run as soon as possible.
Parametersimport_jobCodeImportJob object.
userPerson who makes the request.
Unknown Field: preconditionimport_job.states == PENDING.
import_job.requesting_user is None.
Unknown Field: postconditionimport_job.date_due is now or in the past.
import_job.request_user is set to user.
A REQUEST CodeImportEvent was created.
def updateHeartbeat(import_job, logtail):
Updates the heartbeat of a running CodeImportJob.

Call this method at regular intervals while a job is running to provide progress information for users and prevent the job from being reclaimed by the code-import watchdog.

Parametersimport_jobCodeImportJob with RUNNING state.
logtailstring containing the last few lines of the progress output from the job.
Unknown Field: preconditionimport_job.state == RUNNING.
Unknown Field: postconditionimport_job.heartbeat == UTC_NOW.
import_job.logtail == logtail.
def startJob(import_job, machine):
Record that machine is about to start work on import_job.
Parametersimport_jobCodeImportJob object.
machineCodeImportMachine that will be working on the job.
Unknown Field: preconditionimport_job.state == PENDING.
machine.state == ONLINE.
Unknown Field: postconditionimport_job.state == RUNNING.
import_job.machine == machine.
import_job.date_started == UTC_NOW.
import_job.heartbeat == UTC_NOW.
A START CodeImportEvent was created.
def finishJob(import_job, status, logfile_alias):
Record that a job finished running.

This method creates a CodeImportResult object that records the outcome of the run, deletes import_job from the database and creates a new job that is due appropriately far into the future.

In the conditions below, let code_import = import_job.code_import.

Parametersimport_jobCodeImportJob with RUNNING state.
statusoutcome of the job as a CodeImportResultStatus.
logfile_aliasLibraryFileAlias containing a log file to display for diagnostics. May be None.
Unknown Field: preconditionimport_job.state == RUNNING.
Unknown Field: postconditionimport_job is deleted.
code_import.import_job is not None unless the job has failed more than consecutive_failure_limit times in a row.
code_import.import_job.date_due is import_job.date_due + code_import.effective_update_interval`, with scaling to retry failing imports less often.
A CodeImportResult was created.
A FINISH CodeImportEvent was created.
def reclaimJob(import_job):
Record that import_job has been reclaimed.

This should be called when the job's heartbeat has not been updated for what the code import watchdog deems is 'too long'.

This method creates a CodeImportResult object that records that the job was reclaimed, deletes import_job from the database and creates a new job that is due again immediately.

In the conditions below, let code_import = import_job.code_import.

Parametersimport_jobCodeImportJob object.
Unknown Field: preconditionimport_job.state == RUNNING.
Unknown Field: postconditionimport_job is deleted.
code_import.import_job is not None.
code_import.import_job.date_due is UTC_NOW.
A CodeImportResult was created.
A FINISH CodeImportEvent was created.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.