Mercurial > piecrust2
comparison piecrust/baking/scheduler.py @ 158:1187739e5a19
Fix some indentation and line lengths.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 31 Dec 2014 16:56:55 -0800 |
parents | 91dcbb5fe1e8 |
children | 938be93215cb |
comparison
equal
deleted
inserted
replaced
157:55910ab4bfea | 158:1187739e5a19 |
---|---|
17 self._added_event = threading.Event() | 17 self._added_event = threading.Event() |
18 self._done_event = threading.Event() | 18 self._done_event = threading.Event() |
19 | 19 |
20 def addJob(self, job): | 20 def addJob(self, job): |
21 logger.debug("Queuing job '%s:%s'." % ( | 21 logger.debug("Queuing job '%s:%s'." % ( |
22 job.factory.source.name, job.factory.rel_path)) | 22 job.factory.source.name, job.factory.rel_path)) |
23 with self._lock: | 23 with self._lock: |
24 self.jobs.append(job) | 24 self.jobs.append(job) |
25 self._added_event.set() | 25 self._added_event.set() |
26 | 26 |
27 def onJobFinished(self, job): | 27 def onJobFinished(self, job): |
28 logger.debug("Removing job '%s:%s'." % ( | 28 logger.debug("Removing job '%s:%s'." % ( |
29 job.factory.source.name, job.factory.rel_path)) | 29 job.factory.source.name, job.factory.rel_path)) |
30 with self._lock: | 30 with self._lock: |
31 self._active_jobs.remove(job) | 31 self._active_jobs.remove(job) |
32 self._done_event.set() | 32 self._done_event.set() |
33 | 33 |
34 def getNextJob(self, wait_timeout=None, empty_timeout=None): | 34 def getNextJob(self, wait_timeout=None, empty_timeout=None): |
73 if job == first_job: | 73 if job == first_job: |
74 # None of the jobs are ready... we need to wait. | 74 # None of the jobs are ready... we need to wait. |
75 self.jobs.append(job) | 75 self.jobs.append(job) |
76 return self._WAIT | 76 return self._WAIT |
77 | 77 |
78 logger.debug("Job '%s:%s' is ready to go, moving to active " | 78 logger.debug( |
79 "queue." % (job.factory.source.name, job.factory.rel_path)) | 79 "Job '%s:%s' is ready to go, moving to active queue." % |
80 (job.factory.source.name, job.factory.rel_path)) | |
80 self._active_jobs.append(job) | 81 self._active_jobs.append(job) |
81 return job | 82 return job |
82 | 83 |
83 def _isJobReady(self, job): | 84 def _isJobReady(self, job): |
84 e = self.record.getPreviousEntry(job.factory.source.name, | 85 e = self.record.getPreviousEntry( |
86 job.factory.source.name, | |
85 job.factory.rel_path) | 87 job.factory.rel_path) |
86 if not e: | 88 if not e: |
87 return (True, None) | 89 return (True, None) |
88 for sn, rp in e.used_source_names: | 90 for sn, rp in e.used_source_names: |
89 if sn == job.factory.source.name: | 91 if sn == job.factory.source.name: |
90 continue | 92 continue |
91 if any(filter(lambda j: j.factory.source.name == sn, self.jobs)): | 93 if any(filter(lambda j: j.factory.source.name == sn, self.jobs)): |
92 return (False, sn) | 94 return (False, sn) |
93 if any(filter(lambda j: j.factory.source.name == sn, | 95 if any(filter(lambda j: j.factory.source.name == sn, |
94 self._active_jobs)): | 96 self._active_jobs)): |
95 return (False, sn) | 97 return (False, sn) |
96 return (True, None) | 98 return (True, None) |
97 | 99 |