def __cmp__(self, other):
return self.identity() == other.identity()
+ def __lt__(self, other):
+ return self.identity() < other.identity()
+
def __repr__(self):
return 'JobSpec(shortname=%s, cmdline=%s)' % (self.shortname,
self.cmdline)
message('SKIPPED', spec.shortname, do_newline=True)
self.resultset[spec.shortname] = [skipped_job_result]
return True
- if self.cancelled(): return False
+ if self.cancelled():
+ return False
current_cpu_cost = self.cpu_cost()
- if current_cpu_cost == 0: break
+ if current_cpu_cost == 0:
+ break
if current_cpu_cost + spec.cpu_cost <= self._maxjobs:
if len(self._running) < self._maxjobs_cpu_agnostic:
break
self.reap(spec.shortname, spec.cpu_cost)
- if self.cancelled(): return False
+ if self.cancelled():
+ return False
job = Job(spec, self._newline_on_success, self._travis, self._add_env,
self._quiet_success)
self._running.add(job)
dead = set()
for job in self._running:
st = eintr_be_gone(lambda: job.state())
- if st == _RUNNING: continue
+ if st == _RUNNING:
+ continue
if st == _FAILURE or st == _KILLED:
self._failures += 1
if self._stop_on_failure:
if not self._quiet_success or job.result.state != 'PASSED':
self.resultset[job.GetSpec().shortname].append(job.result)
self._running.remove(job)
- if dead: return
+ if dead:
+ return
if not self._travis and platform_string() != 'windows':
rstr = '' if self._remaining is None else '%d queued, ' % self._remaining
if self._remaining is not None and self._completed > 0:
def cancelled(self):
"""Poll for cancellation."""
- if self._cancelled: return True
- if not self._check_cancelled(): return False
+ if self._cancelled:
+ return True
+ if not self._check_cancelled():
+ return False
for job in self._running:
job.kill()
self._cancelled = True
def finish(self):
while self._running:
- if self.cancelled(): pass # poll cancellation
+ if self.cancelled():
+ pass # poll cancellation
self.reap()
if platform_string() != 'windows':
signal.alarm(0)