def _progress_workflow(self, item, workflow, generator):
        try:
            try:
                error = item is not None and item.error
                if error:
                    LOGGER.debug('Throwing workflow=%r error=%r',
                                 workflow, error)
                    next_item = generator.throw(*error)
                elif isinstance(item, WorkflowItem) and item.done:
                    LOGGER.debug(
                        'Sending workflow=%r finished item=%r',
                        workflow, item)
                    next_item = generator.send(item.result)
                else:
                    LOGGER.debug(
                        'Sending workflow=%r finished item=%r',
                        workflow, item)
                    next_item = generator.send(item)
            except __HOLE__:
                LOGGER.debug('Exhausted workflow=%r', workflow)
                workflow.done = True
            except Return as e:
                LOGGER.debug('Return from workflow=%r result=%r',
                             workflow, e.result)
                workflow.done = True
                workflow.result = e.result
            except Exception as e:
                LOGGER.exception(
                    'Error in workflow=%r from item=%r, error=%r',
                    workflow, item, error)
                workflow.done = True
                workflow.error = sys.exc_info()
            else:
                barrier = Barrier(workflow, generator, next_item)
                self.pending.enqueue(barrier)
        finally:
            if workflow.done:
                if workflow.root:
                    # Root workflow finished. This goes to the output
                    # queue so it can be received by the main thread.
                    return workflow
                else:
                    # Sub-workflow finished. Reinject it into the
                    # workflow so a pending parent can catch it.
                    self.input_queue.put(workflow)

        return None
dataset/ETHPy150Open bslatkin/dpxdt/dpxdt/client/workers.py/WorkflowThread._progress_workflow