Starts the Service. Raises: WebDriverException: Raised either when it can't start the service or when it can't connect to the service
(self)
| 98 | self._path = str(value) |
| 99 | |
| 100 | def start(self) -> None: |
| 101 | """Starts the Service. |
| 102 | |
| 103 | Raises: |
| 104 | WebDriverException: Raised either when it can't start the service |
| 105 | or when it can't connect to the service |
| 106 | """ |
| 107 | if self._path is None: |
| 108 | raise WebDriverException("Service path cannot be None.") |
| 109 | self._start_process(self._path) |
| 110 | |
| 111 | deadline = monotonic() + self._start_timeout |
| 112 | count = 0 |
| 113 | try: |
| 114 | while True: |
| 115 | self.assert_process_still_running() |
| 116 | if self.is_connectable(): |
| 117 | break |
| 118 | if monotonic() >= deadline: |
| 119 | raise WebDriverException(f"Can not connect to the Service {self._path}") |
| 120 | # sleep increasing: 0.01, 0.06, 0.11, 0.16, 0.21, 0.26, 0.31, 0.36, 0.41, 0.46, 0.5 |
| 121 | sleep(min(0.01 + 0.05 * count, 0.5)) |
| 122 | count += 1 |
| 123 | except BaseException: |
| 124 | try: |
| 125 | self.stop() |
| 126 | except Exception: |
| 127 | logger.exception("Error stopping service after a failed start.") |
| 128 | raise |
| 129 | |
| 130 | def assert_process_still_running(self) -> None: |
| 131 | """Check if the underlying process is still running.""" |
nothing calls this directly
no test coverage detected