Establish sync socket connection to arbiter. Raises: DirtyConnectionError: If connection fails
(self)
| 57 | # ------------------------------------------------------------------------- |
| 58 | |
| 59 | def connect(self): |
| 60 | """ |
| 61 | Establish sync socket connection to arbiter. |
| 62 | |
| 63 | Raises: |
| 64 | DirtyConnectionError: If connection fails |
| 65 | """ |
| 66 | if self._sock is not None: |
| 67 | return |
| 68 | |
| 69 | try: |
| 70 | self._sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) |
| 71 | self._sock.settimeout(self.timeout) |
| 72 | self._sock.connect(self.socket_path) |
| 73 | except (socket.error, OSError) as e: |
| 74 | self._sock = None |
| 75 | raise DirtyConnectionError( |
| 76 | f"Failed to connect to dirty arbiter: {e}", |
| 77 | socket_path=self.socket_path |
| 78 | ) from e |
| 79 | |
| 80 | def execute(self, app_path, action, *args, **kwargs): |
| 81 | """ |