def wait_for_dag(self, timeout=0): if not self.is_mining and not self.geth_kwargs.get('autodag', False): raise ValueError("Geth not configured to generate DAG") with Timeout(timeout) as _timeout: while True: if self.is_dag_generated: break time.sleep(0.1) _timeout.check()
def wait_for_ipc(self, timeout=0): if not self.ipc_enabled: raise ValueError("IPC interface is not enabled") with Timeout(timeout) as _timeout: while True: if self.is_ipc_ready: break time.sleep(0.1) _timeout.check()
def test_waiting_for_dag_generation(base_dir): assert not is_dag_generated(base_dir=base_dir) command, proc = spawn_geth( dict( data_dir=base_dir, suffix_args=['makedag', '0', base_dir], )) assert not is_dag_generated(base_dir=base_dir) with Timeout(600) as timeout: while True: if is_dag_generated(base_dir=base_dir): break time(0.1) timeout.check() assert proc.poll() is not None assert proc.returncode == 0
def join(self, timeout=None): with Timeout(timeout) as _timeout: while not self.empty(): time.sleep(0) _timeout.check()