packages/vaex-core/vaex/legacy.py
def _task(self, task, progressbar=False):
        """Helper function for returning tasks results, result when immediate is True, otherwise the task itself, which is a promise"""
        if self.delay:
            # should return a task or a promise nesting it
            return self.executor.schedule(task)
        else:
            import vaex.utils
            callback = None
            try:
                if progressbar == True:
                    def update(fraction):
                        bar.update(fraction)
                        return True
                    bar = vaex.utils.progressbar(task.name)
                    callback = self.executor.signal_progress.connect(update)
                elif progressbar:
                    callback = self.executor.signal_progress.connect(progressbar)
                result = self.executor.run(task)
                if progressbar == True:
                    bar.finish()
                    sys.stdout.write('\n')
                return result
            finally:
                if callback:
                    self.executor.signal_progress.disconnect(callback)
def _task(self, task, progressbar=False):
        """Helper function for returning tasks results, result when immediate is True, otherwise the task itself, which is a promise"""
        if self.delay:
            # should return a task or a promise nesting it
            return self.executor.schedule(task)
        else:
            import vaex.utils
            callback = None
            try:
                if progressbar == True:
                    def update(fraction):
                        bar.update(fraction)
                        return True
                    bar = vaex.utils.progressbar(task.name)
                    callback = self.executor.signal_progress.connect(update)
                elif progressbar:
                    callback = self.executor.signal_progress.connect(progressbar)
                result = self.executor.run(task)
                if progressbar == True:
                    bar.finish()
                    sys.stdout.write('\n')
                return result
            finally:
                if callback:
                    self.executor.signal_progress.disconnect(callback)
Helper function for returning tasks results, result when immediate is True, otherwise the task itself, which is a promise