continue
else:
assert 0, 'error listing machines'
- num_up = len(filter(lambda machine: machine['up'] and machine['type']
- == machine_type, machines))
+
+ is_up = lambda machine: machine['up'] and machine['type'] == machine_type # noqa
+ num_up = len(filter(is_up, machines))
assert num_up >= how_many, 'not enough machines are up'
# make sure there are machines for non-automated jobs to run
- num_free = len(filter(lambda machine: machine['up'] and
- machine['locked'] == 0 and machine['type'] ==
- machine_type, machines))
+ is_up_and_free = lambda machine: machine['up'] and machine['locked'] == 0 and machine['type'] == machine_type # noqa
+ up_and_free = filter(is_up_and_free, machines)
+ num_free = len(up_and_free)
if num_free < 6 and ctx.owner.startswith('scheduled'):
if ctx.block:
log.info(