~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/job/interfaces/job.py

Merge db-devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
    'ITwistedJobSource',
15
15
    'JobStatus',
16
16
    'LeaseHeld',
 
17
    'SuspendJobException',
17
18
    ]
18
19
 
19
20
 
35
36
from canonical.launchpad import _
36
37
 
37
38
 
 
39
class SuspendJobException(Exception):
 
40
    """Raised when a running job wants to suspend itself."""
 
41
    pass
 
42
 
 
43
 
38
44
class LeaseHeld(Exception):
39
45
    """Raised when attempting to acquire a list that is already held."""
40
46
 
99
105
    attempt_count = Int(title=_(
100
106
        'The number of attempts to perform this job that have been made.'))
101
107
 
 
108
    max_retries = Int(title=_(
 
109
        'The number of retries permitted before this job permanently fails.'))
 
110
 
102
111
    def acquireLease(duration=300):
103
112
        """Acquire the lease for this Job, or raise LeaseHeld."""
104
113
 
149
158
    user_error_types = Attribute(
150
159
        'A tuple of exception classes which result from user error.')
151
160
 
 
161
    retry_error_types = Attribute(
 
162
        'A tuple of exception classes which should cause a retry.')
 
163
 
152
164
    def notifyUserError(e):
153
165
        """Notify interested parties that this job encountered a user error.
154
166