(self)
| 140 | ) |
| 141 | |
| 142 | def main(self) -> None: |
| 143 | self.stop = False |
| 144 | self.client.login() |
| 145 | self.endpoints.init() |
| 146 | |
| 147 | while not self.stop: |
| 148 | self.log.debug("waiting for a lock in the update loop.") |
| 149 | with self.lock: |
| 150 | if not self.pending_shutdown: |
| 151 | self.log.debug("lock acquired in the update loop.") |
| 152 | try: |
| 153 | self._update_system() |
| 154 | self._update_sn() |
| 155 | |
| 156 | with concurrent.futures.ThreadPoolExecutor() as executor: |
| 157 | executor.map(lambda f: f(), self.update_funcs) |
| 158 | |
| 159 | self.data_ready = True |
| 160 | except RuntimeError as e: |
| 161 | self.stop = True |
| 162 | self.log.error( |
| 163 | f"Error detected, trying to gracefully log out from redfish api.\n{e}" |
| 164 | ) |
| 165 | self.client.logout() |
| 166 | raise |
| 167 | sleep(self.refresh_interval) |
| 168 | self.log.debug("lock released in the update loop.") |
| 169 | self.log.debug("exiting update loop.") |
| 170 | raise SystemExit(0) |
| 171 | |
| 172 | def flush(self) -> None: |
| 173 | self.log.debug("Acquiring lock to flush data.") |
nothing calls this directly
no test coverage detected