~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2011-06-21 13:24:57 UTC
  • mto: This revision was merged to the branch mainline in revision 13270.
  • Revision ID: aaron@canonical.com-20110621132457-1e77wouwofd5nv4s
Fix failing test and lint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
__all__ = [
9
9
    'BaseRunnableJob',
 
10
    'BaseRunnableJobSource',
10
11
    'JobCronScript',
11
12
    'JobRunner',
12
13
    'JobRunnerProcess',
66
67
    )
67
68
 
68
69
 
69
 
class BaseRunnableJob:
 
70
class BaseRunnableJobSource:
 
71
    """Base class for job sources for the job runner."""
 
72
 
 
73
    memory_limit = None
 
74
 
 
75
    @staticmethod
 
76
    @contextlib.contextmanager
 
77
    def contextManager():
 
78
        yield
 
79
 
 
80
 
 
81
class BaseRunnableJob(BaseRunnableJobSource):
70
82
    """Base class for jobs to be run via JobRunner.
71
83
 
72
84
    Derived classes should implement IRunnableJob, which requires implementing
81
93
 
82
94
    retry_error_types = ()
83
95
 
84
 
    memory_limit = None
85
 
 
86
96
    # We redefine __eq__ and __ne__ here to prevent the security proxy
87
97
    # from mucking up our comparisons in tests and elsewhere.
88
98
    def __eq__(self, job):
153
163
            return
154
164
        ctrl.send()
155
165
 
156
 
    @staticmethod
157
 
    @contextlib.contextmanager
158
 
    def contextManager():
159
 
        yield
160
 
 
161
166
 
162
167
class BaseJobRunner(object):
163
168
    """Runner of Jobs."""