Establish async connection to arbiter. Raises: DirtyConnectionError: If connection fails
(self)
| 195 | # ------------------------------------------------------------------------- |
| 196 | |
| 197 | async def connect_async(self): |
| 198 | """ |
| 199 | Establish async connection to arbiter. |
| 200 | |
| 201 | Raises: |
| 202 | DirtyConnectionError: If connection fails |
| 203 | """ |
| 204 | if self._writer is not None: |
| 205 | return |
| 206 | |
| 207 | try: |
| 208 | self._reader, self._writer = await asyncio.wait_for( |
| 209 | asyncio.open_unix_connection(self.socket_path), |
| 210 | timeout=self.timeout |
| 211 | ) |
| 212 | except asyncio.TimeoutError: |
| 213 | raise DirtyTimeoutError( |
| 214 | "Timeout connecting to dirty arbiter", |
| 215 | timeout=self.timeout |
| 216 | ) |
| 217 | except (OSError, ConnectionError) as e: |
| 218 | raise DirtyConnectionError( |
| 219 | f"Failed to connect to dirty arbiter: {e}", |
| 220 | socket_path=self.socket_path |
| 221 | ) from e |
| 222 | |
| 223 | async def execute_async(self, app_path, action, *args, **kwargs): |
| 224 | """ |