<s> from __future__ import absolute_import , print_function <EOL> import itertools <EOL> from . import cli , exceptions , log , parallel <EOL> from . master import CURRENT as MASTER <EOL> dne = True <EOL> missing_slave = set ( [ ] ) <EOL> def files ( fn , fltr , flist , active_only = False , fail = True ) : <EOL> global dne <EOL> tlist = MASTER . tasks ( fltr , active_only = active_only ) <EOL> dne = True <EOL> def process ( ( task , fname ) ) : <EOL> global dne <EOL> try : <EOL> fobj = task . file ( fname ) <EOL> except exceptions . SlaveDoesNotExist : <EOL> if task [ "<STR_LIT:id>" ] not in missing_slave : <EOL> cli . header ( "<STR_LIT>" . format ( <EOL> task [ "<STR_LIT:id>" ] , fname ) ) <EOL> print ( "<STR_LIT>" ) <EOL> missing_slave . add ( task [ "<STR_LIT:id>" ] ) <EOL> raise exceptions . SkipResult <EOL> if fobj . exists ( ) : <EOL> dne = False <EOL> return fn ( fobj ) <EOL> elements = itertools . chain ( <EOL> * [ [ ( task , fname ) for fname in flist ] for task in tlist ] ) <EOL> for result in parallel . stream ( process , elements ) : <EOL> if not result : <EOL> continue <EOL> yield result <EOL> if dne and fail : <EOL> log . fatal ( "<STR_LIT>" ) </s>
