def __init__(self, workflow, generator, work):
        """Initializer.

        Args:
            workflow: WorkflowItem instance this is for.
            generator: Current state of the WorkflowItem's generator.
            work: Next set of work to do. May be a single WorkItem object or
                a list or tuple that contains a set of WorkItems to run in
                parallel.
        """
        super(Barrier, self).__init__()
        self.workflow = workflow
        self.generator = generator

        if isinstance(work, (list, tuple)):
            self[:] = list(work)
            self.was_list = True
            self.wait_any = False
        elif isinstance(work, WaitAny):
            self[:] = list(work.items)
            self.was_list = True
            self.wait_any = True
        else:
            self[:] = [work]
            self.was_list = False
            self.wait_any = False

        for item in self:
            assert isinstance(item, WorkItem)
            item.parent = workflow
def __init__ ( self , workflow , generator , work ) : super ( Barrier , self ) . __init__ ( ) self . workflow = workflow self . generator = generator if isinstance ( work , ( list , tuple ) ) : self [ : ] = list ( work ) self . was_list = True self . wait_any = False elif isinstance ( work , WaitAny ) : self [ : ] = list ( work . items ) self . was_list = True self . wait_any = True else : self [ : ] = [ work ] self . was_list = False self . wait_any = False for item in self : assert isinstance ( item , WorkItem ) item . parent = workflow
Initializer.

        Args:
            workflow: WorkflowItem instance this is for.
            generator: Current state of the WorkflowItem's generator.
            work: Next set of work to do. May be a single WorkItem object or
                a list or tuple that contains a set of WorkItems to run in
                parallel.