Best Python code snippet using lisa_python
parallel.py
Source:parallel.py  
...90    def check_cancelled(self) -> None:91        if self._cancelled:92            raise LisaException("Tasks are cancelled")93    def has_idle_worker(self) -> bool:94        self._process_done_futures()95        return len(self._futures) < self._max_workers96    def wait_worker(self, return_condition: str = FIRST_COMPLETED) -> bool:97        """98        Return:99            True, if there is running worker.100        """101        wait(self._futures[:], return_when=return_condition)102        self._process_done_futures()103        return len(self._futures) > 0104    def _process_done_futures(self) -> None:105        for future in self._futures[:]:106            if future.done():107                # join exceptions of subthreads to main thread108                result = future.result()109                # removed finished threads110                self._futures.remove(future)111                # exception will throw at this point112                if self._callback:113                    self._callback(result)114                self._future_task_map[future].close()115                self._future_task_map.pop(future)116    def wait_for_all_workers(self) -> None:117        remaining_worker_count = self.wait_worker(return_condition=ALL_COMPLETED)118        assert_that(remaining_worker_count).is_zero()...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
