Part of lp.code.interfaces.codeimportjob View In Hierarchy
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. |
CodeImportJob
associated with a reviewed CodeImport
.
Call this method from CodeImport.updateFromData
when the
review_status of code_import
changes to REVIEWED.
Parameters | code_import | CodeImport object. |
interval | Schedule 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. | |
Returns | A new CodeImportJob object associated to code_import . | |
Unknown Field: precondition | code_import has REVIEWED review_status. | |
code_import has no associated CodeImportJob . |
CodeImportJob
associated with a CodeImport
.
Call this method from CodeImport.updateFromData
when the
review_status of code_import
changes from REVIEWED.
Parameters | code_import | CodeImport object. |
Unknown Field: precondition | code_import .review_status != REVIEWED. | |
code_import is associated to a CodeImportJob . | ||
code_import .import_job.state == PENDING. | ||
Unknown Field: postcondition | code_import .import_job is None. |
Parameters | import_job | CodeImportJob object. |
user | Person who makes the request. | |
Unknown Field: precondition | import_job .states == PENDING. | |
import_job .requesting_user is None. | ||
Unknown Field: postcondition | import_job .date_due is now or in the past. | |
import_job .request_user is set to user . | ||
A REQUEST CodeImportEvent was created. |
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.
Parameters | import_job | CodeImportJob with RUNNING state. |
logtail | string containing the last few lines of the progress output from the job. | |
Unknown Field: precondition | import_job .state == RUNNING. | |
Unknown Field: postcondition | import_job .heartbeat == UTC_NOW. | |
import_job .logtail == logtail. |
machine
is about to start work on import_job
.Parameters | import_job | CodeImportJob object. |
machine | CodeImportMachine that will be working on the job. | |
Unknown Field: precondition | import_job .state == PENDING. | |
machine .state == ONLINE. | ||
Unknown Field: postcondition | import_job .state == RUNNING. | |
import_job .machine == machine. | ||
import_job .date_started == UTC_NOW. | ||
import_job .heartbeat == UTC_NOW. | ||
A START CodeImportEvent was created. |
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
.
Parameters | import_job | CodeImportJob with RUNNING state. |
status | outcome of the job as a CodeImportResultStatus . | |
logfile_alias | LibraryFileAlias containing a log file to
display for diagnostics. May be None. | |
Unknown Field: precondition | import_job .state == RUNNING. | |
Unknown Field: postcondition | import_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. |
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
.
Parameters | import_job | CodeImportJob object. |
Unknown Field: precondition | import_job .state == RUNNING. | |
Unknown Field: postcondition | import_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. |