(self)
| 550 | self.monitor.log(metric, step) |
| 551 | |
| 552 | async def shutdown(self) -> None: |
| 553 | # Stop the FULLY_ASYNC background watcher before tearing down models. |
| 554 | self._async_watch_stopped = True |
| 555 | if self._async_watch_task is not None and not self._async_watch_task.done(): |
| 556 | self._async_watch_task.cancel() |
| 557 | try: |
| 558 | await self._async_watch_task |
| 559 | except asyncio.CancelledError: |
| 560 | pass |
| 561 | if self.rollout_coordinator: |
| 562 | await self.rollout_coordinator.shutdown.remote() |
| 563 | self.rollout_coordinator = None |
| 564 | if self.monitor: |
| 565 | self.monitor.close() |
| 566 | self.monitor = None |
| 567 | handlers = [] |
| 568 | for model in self.models: |
| 569 | handlers.append(model.shutdown()) |
| 570 | for auxiliary_model_list in self.auxiliary_models: |
| 571 | for model in auxiliary_model_list: |
| 572 | handlers.append(model.shutdown()) |
| 573 | await asyncio.gather(*handlers) |
| 574 | self.logger.info( |
| 575 | f"Explorer ({self.config.explorer.name}) shutdown successfully at step {self.explore_step_num}." |
| 576 | ) |
| 577 | |
| 578 | async def is_alive(self) -> bool: |
| 579 | """Check if the explorer is alive.""" |
no test coverage detected