def awaitTermination(self, timeout=None):
        if self.scheduler is None:
            raise RuntimeError('StreamimgContext not started')

        try:
            deadline = time.time() + timeout if timeout is not None else None
            while True:
                is_terminated = self._runOnce()
                if is_terminated or (
                        deadline is not None and time.time() > deadline):
                    break
                if self.batchCallback:
                    self.batchCallback()
        except __HOLE__:
            pass
        finally:
            self.sc.stop()
            logger.info("StreamingContext stopped successfully")
dataset/ETHPy150Open douban/dpark/dpark/dstream.py/StreamingContext.awaitTermination